본문 바로가기

알고리즘 문제 풀기

BOJ 3052 - 나머지 https://www.acmicpc.net/problem/3052 BOJ 3052 - 나머지 작성언어: Python3remain = []​for i in range(10): num = int(input()) if num % 42 not in remain: remain.append(num % 42)​print(len(remain))pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 2577 - 숫자의 개수 https://www.acmicpc.net/problem/2577 BOJ 2577 - 숫자의 개수 작성언어: Python3num1 = int(input())num2 = int(input())num3 = int(input())result = str(num1 * num2 * num3)number_list = []​for i in range(0, 10): count = 0 for num in result: if str(i) == num: count += 1 number_list.append(count)​for item in number_list: print(item)pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 2920 - 음계 https://www.acmicpc.net/problem/2920 BOJ 2920 - 음계 작성언어: Python3scale = list(map(int, input().split()))​if scale == [1, 2, 3, 4, 5, 6, 7, 8]: print('ascending')elif scale == [8, 7, 6, 5, 4, 3, 2, 1]: print('descending')else: print('mixed')pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 2562 - 최댓값 https://www.acmicpc.net/problem/2562 BOJ 2562 - 최댓값 작성언어: Python3biggest = 0index = 0​for i in range(9): num = int(input()) if biggest
BOJ 10818 - 최소, 최대 https://www.acmicpc.net/problem/10818 BOJ 10818 - 최소, 최대 작성언어: Python3n = int(input())numbers = list(map(int, input().split()))numbers.sort()print(numbers[0], numbers[len(numbers)-1])pc 환경에서 코드를 보는 것을 권장합니다.
BOJ 10952 - A+B - 5 https://www.acmicpc.net/problem/10952 BOJ 10952 - A+B - 5 작성언어: Python3results = []​while(True): num1, num2 = map(int, input().split()) if num1 == num2 == 0: break results.append(num1 + num2)​for result in results: print(result)pc 환경에서 코드를 보는 것을 추천합니다.
BOJ 10951 - A+B - 4 https://www.acmicpc.net/problem/10951 BOJ 10951 - A+B - 4 작성언어: Python3while(True): try: num1, num2 = map(int, input().split()) print(num1 + num2) except EOFError: breakpc 환경에서 코드를 보는 것을 권장합니다.
BOJ 11022 - A+B - 8 https://www.acmicpc.net/problem/11022 BOJ 11022 - A+B - 8 작성언어: Python3t = int(input())results = []​for i in range(1, t+1): num1, num2 = map(int, input().split()) results.append('Case #' + str(i) + ': ' + str(num1) + ' + ' + str(num2) + ' = ' + str(num1+num2))​for result in results: print(result)pc 환경에서 코드를 보는 것을 권장합니다.