https://www.acmicpc.net/problem/10844
10844๋ฒ: ์ฌ์ด ๊ณ๋จ ์
์ฒซ์งธ ์ค์ ์ ๋ต์ 1,000,000,000์ผ๋ก ๋๋ ๋๋จธ์ง๋ฅผ ์ถ๋ ฅํ๋ค.
www.acmicpc.net
n = int(input())
stair = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for _ in range(n+1)]
stair[1] = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
for i in range(2, n+1):
for j in range(10):
if j == 0:
stair[i][0] = stair[i-1][1]
elif j == 9:
stair[i][9] = stair[i-1][8]
else:
stair[i][j] = stair[i-1][j-1] + stair[i-1][j+1]
print(sum(stair[n]) % 1000000000)
'๐ค > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ฐฑ์ค 11053: ๊ฐ์ฅ ๊ธด ์ฆ๊ฐํ๋ ๋ถ๋ถ ์์ด (Python) (0) | 2022.04.07 |
---|---|
๋ฐฑ์ค 2156: ํฌ๋์ฃผ ์์ (Python) (0) | 2022.04.07 |
๋ฐฑ์ค 1463: 1๋ก ๋ง๋ค๊ธฐ (Python) (0) | 2022.04.05 |
๋ฐฑ์ค 2579: ๊ณ๋จ ์ค๋ฅด๊ธฐ (Python) (0) | 2022.04.05 |
๋ฐฑ์ค 1932: ์ ์ ์ผ๊ฐํ (Python) (0) | 2022.04.01 |