728x90
반응형
기본적인 다이나믹 프로그래밍 문제이다.
R, C, W = map(int, input().split())
li = [[1], [1, 1]]
for i in range(2, R+W-1):
t = [1]
for j in range(1, i):
t.append(li[i-1][j-1]+li[i-1][j])
t.append(1)
li.append(t)
res, w = 0, 1
for i in range(R-1, R+W-1):
for j in range(w):
res += li[i][C-1+j]
w += 1
print(res)
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
백준 알고리즘 1991번 트리 순회(python) (0) | 2021.03.17 |
---|---|
백준 알고리즘 2670번 연속부분최대곱(python) (0) | 2021.03.17 |
백준 알고리즘 16395번 파스칼의 삼각형(python) (0) | 2021.03.17 |
백준 알고리즘 6080번 Bad Grass(python) (0) | 2021.03.17 |
백준 알고리즘 20540번 연길이의 이상형(python) (0) | 2021.03.17 |