백준 12101 - 1, 2, 3 더하기 2 (Python)
문제 https://www.acmicpc.net/problem/12101 12101번: 1, 2, 3 더하기 2 n을 1, 2, 3의 합으로 나타내는 방법 중에서 사전 순으로 k번째에 오는 것을 출력한다. k번째 오는 식이 없는 경우에는 -1을 출력한다. www.acmicpc.net 풀이 n,k = map(int,input().split()) save = {} save[1] = ["1"] save[2] = ["1+1","2"] save[3] = ["1+2","1+1+1","2+1","3"] for i in range(4,12): save[i] = [] for j in save[i-1]: save[i].append(j+"+1") for j in save[i-2]: save[i].append(j+"+2") ..
2024.02.16