본문 바로가기
SMALL

알고리즘16

[SW Expert Academy] 최대수 구하기 *문제의 저작권은 SW Expert에 있습니다. 문제 링크 : https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QQhbqA4QDFAUq&categoryId=AV5QQhbqA4QDFAUq&categoryType=CODE T = int(input()) for test_case in range(1, T + 1): result = list(map(int, input().split(" "))) result.sort(reverse=True) print("#{} {}".format(test_case,result[0])) 2021. 1. 20.
[SW Expert Academy] 큰 놈, 작은 놈, 같은 놈 *문제의 저작권은 SW Expert에 있습니다. 문제 링크 : https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QQ6qqA40DFAUq&categoryId=AV5QQ6qqA40DFAUq&categoryType=CODE T = int(input()) for test_case in range(1, T + 1): result = list(map(int, input().split(" "))) if result[0]!=result[1] : if result[0]>result[1] : print("#{} {}".format(test_case,">")) else : print("#{} {}".format(test_case," 2021. 1. 20.
[SW Expert Academy] 평균값 구하기 *문제의 저작권은 SW Expert에 있습니다. 문제 링크 : https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QRnJqA5cDFAUq&categoryId=AV5QRnJqA5cDFAUq&categoryType=CODE T = int(input()) for test_case in range(1, T + 1): result = list(map(int, input().split(" "))) print("#{} {}".format(test_case, round(sum(result)/len(result))) 2021. 1. 20.
[SW Expert Academy] 홀수만 더하기 *문제의 저작권은 SW Expert에 있습니다. 문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QSEhaA5sDFAUq 10개의 수를 입력 받아, 그 중에서 홀수만 더한 값을 출력하는 프로그램을 작성하는 문제 T = int(input()) for i in range(T): result = list(map(int, input().split(" "))) odd_nums = [num for num in result if num % 2 == 1] print("#{} {}".format(i+1, sum(odd_nums))) 2021. 1. 20.
LIST