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

import sys
from collections import deque

input = sys.stdin.readline

T = int(input().rstrip())
for i in range(T):
    k = int(input().rstrip())
    n = int(input().rstrip())
    people = [i for i in range(1, n+1)] # 0์ธต
    # 1์ธต 3ํ˜ธ 6๋ช… 2์ธต์˜ 3ํ˜ธ 10๋ช…

    for j in range(k):
        apt = []
        for l in range(n):
            apt.append(sum(people[:l+1]))
        people = apt.copy()
        print(people)

    print(people[-1])
๋ฐ˜์‘ํ˜•

'Programming > ๋ฐฑ์ค€' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Python] ๋ฐฑ์ค€ 10811 : ๋ฐ”๊ตฌ๋‹ˆ ๋’ค์ง‘๊ธฐ, ํŒŒ์ด์ฌ  (0) 2024.01.09
๋ž˜ํผ๋Ÿฐ์Šค  (0) 2023.09.02
230228 [1327: ์†ŒํŠธ๊ฒŒ์ž„]  (0) 2023.09.02
230219 [10026: DFS]  (0) 2023.09.02
230219 [2606: DFS]  (0) 2023.09.02