20210622#(46) 백준 9095 1, 2, 3 더하기(다이나믹 프로그래밍)
https://www.acmicpc.net/problem/9095 9095번: 1, 2, 3 더하기 각 테스트 케이스마다, n을 1, 2, 3의 합으로 나타내는 방법의 수를 출력한다. www.acmicpc.net #1 n=int(input()) dp=[0,1,2,4] for i in range(4,11): dp.append(dp[i-3]+dp[i-2]+dp[i-1]) for i in range(n): testcase=int(input()) print(dp[testcase]) #2 함수이용(이해하기에 좀 더 쉬울수도 있음) num=int(input()) def sol(n): if n==1: return 1 elif n==2: return 2 elif n==3: return 4 else: return sol..
2021. 6. 22.