結果

問題 No.1011 Infinite Stairs
ユーザー c-yanc-yan
提出日時 2020-06-21 07:52:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 79,324 KB
最終ジャッジ日時 2023-09-24 11:18:23
合計ジャッジ時間 4,190 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,544 KB
testcase_01 AC 72 ms
71,140 KB
testcase_02 AC 82 ms
76,596 KB
testcase_03 AC 141 ms
78,580 KB
testcase_04 AC 172 ms
78,240 KB
testcase_05 AC 173 ms
79,324 KB
testcase_06 AC 70 ms
71,604 KB
testcase_07 AC 88 ms
76,408 KB
testcase_08 AC 72 ms
71,108 KB
testcase_09 AC 72 ms
71,276 KB
testcase_10 AC 81 ms
76,220 KB
testcase_11 AC 118 ms
77,500 KB
testcase_12 AC 78 ms
76,052 KB
testcase_13 AC 99 ms
76,992 KB
testcase_14 AC 78 ms
76,128 KB
testcase_15 AC 94 ms
77,120 KB
testcase_16 AC 144 ms
78,412 KB
testcase_17 AC 149 ms
77,948 KB
testcase_18 AC 107 ms
77,788 KB
testcase_19 AC 78 ms
76,116 KB
testcase_20 AC 80 ms
76,388 KB
testcase_21 AC 92 ms
77,044 KB
testcase_22 AC 136 ms
78,192 KB
testcase_23 AC 93 ms
77,192 KB
testcase_24 AC 92 ms
77,164 KB
testcase_25 AC 107 ms
77,564 KB
testcase_26 AC 85 ms
76,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# PyPy でのみ AC
N, d, K = map(int, input().split())

m = 1000000007

buf0 = [0] * (d * N + K + 1)
buf1 = [0] * (d * N + K + 1)
buf0[0] = 1

for i in range(N):
    t = 0
    for j in range(d):
        t += buf0[j]
        t %= m
        buf1[j] = t
    for j in range(d, (i + 1) * d):
        t -= buf0[j - d]
        t += buf0[j]
        t %= m
        buf1[j] = t
    buf0, buf1 = buf1, buf0

print(buf0[K - N])
0