백준 [ALGORITHM] - 로마 숫자 만들기 (16922)

2024. 2. 15. 14:30코딩/백준 [ALGORITHM]

반응형
from itertools import combinations_with_replacement

answer = []

def check_sum(n, lst):
    combination = combinations_with_replacement(lst, n)
    
    for combination in combination:
        total = sum(combination)
        answer.append(total)

N = int(input())
lst = [1,5,10,50]

check_sum(N, lst)

print(len(set(answer)))
반응형