본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#52 백준 파이썬 [2775] 부녀회장이 될테야

https://www.acmicpc.net/problem/2775





#Solution


apartment = []

for i in range(15):
line = []
for j in range(14):
line.append(0)
apartment.append(line)

for i in range(0,14):
apartment[0][i] = i+1

for i in range(1,15):
for j in range(14):
apartment[i][j] = apartment[i-1][j] + apartment[i][j-1]

test = int(input())
result = []

for i in range(test):
a = int(input())
b = int(input())
result.append(apartment[a][b-1])

for answer in result:
print(int(answer))