[python]백준 9095번 : 1,2,3 더하기
Algorithm 문제/BOJ 2020. 2. 1. 17:08

문제 : 백준 9095번 _ 1,2,3 더하기 https://www.acmicpc.net/problem/9095 나의 답 # 백준 9095번: 1,2,3 더하기 # 2020-02-01 case = int(input()) # 입력받기 num = [] def cpt_num(n): if n>3: # 3보다 크면 return cpt_num(n-3) + cpt_num(n-2) + cpt_num(n-1) elif n==3: # 3이면 return 4 elif n==2: # 2이면 return 2 elif n==1: # 1이면 return 1 while case : case-=1 num.append(int(input())) for n in num: print(cpt_num(n)) 어제 배웠던 다이나믹 프로그래밍을 활..