ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

728x90

๐Ÿšฉ ์žฌ๊ท€ํ•จ์ˆ˜

 

thinking

point๋Š” ์žฌ๊ท€ํ•จ์ˆ˜๋กœ ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

์ฒ˜์Œ์— 1๋ฒˆ ์‚ฌ๊ฐํ˜•(10x20)์ด 3๊ฐœ์ธ ๊ฒฝ์šฐ๋Š” ์–ด๋–ป๊ฒŒ ํ•ด์„ํ•ด์•ผ ๊ณ ๋ฏผํ–ˆ๋Š”๋ฐ ๊ฐ€๋กœ์˜ ๊ธธ์ด๋งŒ์„ ๊ธฐ์ค€์œผ๋กœ ๋‚˜๋ˆ ์„œ ์ƒ๊ฐํ•˜๋ฉด ์žฌ๊ท€๋กœ ํ•จ์ˆ˜๋ฅผ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.

 

์ฝ”๋“œ

def paper_cut(n):
    if n == 1:
        return 1
    elif n == 2:
        return 3
    return paper_cut(n-1) + paper_cut(n-2) * 2


T = int(input())
for tc in range(1, T+1):
    N = int(input())
    ans = paper_cut(N//10)

    print("#{} {}".format(tc, ans))
๋Œ“๊ธ€