[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)) ์–ด์ œ ๋ฐฐ์› ๋˜ ๋‹ค์ด๋‚˜๋ฏน ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ํ™œ..