結果

問題 No.616 へんなソート
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-03-12 18:26:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 82,644 KB
実行使用メモリ 64,252 KB
最終ジャッジ日時 2024-04-25 18:17:42
合計ジャッジ時間 2,889 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,444 KB
testcase_01 AC 33 ms
53,068 KB
testcase_02 AC 36 ms
53,024 KB
testcase_03 AC 40 ms
60,656 KB
testcase_04 AC 40 ms
61,228 KB
testcase_05 AC 34 ms
52,760 KB
testcase_06 AC 40 ms
60,504 KB
testcase_07 AC 40 ms
60,152 KB
testcase_08 AC 40 ms
60,632 KB
testcase_09 AC 45 ms
61,640 KB
testcase_10 AC 39 ms
59,904 KB
testcase_11 AC 41 ms
61,740 KB
testcase_12 AC 45 ms
62,596 KB
testcase_13 AC 100 ms
64,252 KB
testcase_14 AC 45 ms
62,420 KB
testcase_15 AC 39 ms
59,936 KB
testcase_16 AC 40 ms
60,676 KB
testcase_17 AC 74 ms
63,344 KB
testcase_18 AC 50 ms
62,292 KB
testcase_19 AC 50 ms
62,116 KB
testcase_20 AC 40 ms
60,320 KB
testcase_21 AC 42 ms
60,232 KB
testcase_22 AC 44 ms
60,976 KB
testcase_23 AC 35 ms
52,956 KB
testcase_24 AC 34 ms
52,336 KB
testcase_25 AC 34 ms
52,488 KB
testcase_26 AC 34 ms
52,408 KB
testcase_27 AC 34 ms
53,352 KB
testcase_28 AC 215 ms
63,300 KB
testcase_29 AC 214 ms
63,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
n, k = map(int, input().split())
dp = [1]*(k+1)
for i in range(1, n+1):
    for j in range(1, k+1):
        dp[j] += dp[j-1]
        dp[j] %= mod
    for j in range(k+1)[::-1]:
        if j-i+1 > 0:
            dp[j] -= dp[j-i]
            dp[j] %= mod
print(dp[k])
0