結果

問題 No.269 見栄っ張りの募金活動
ユーザー mlihua09mlihua09
提出日時 2020-09-01 19:58:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 292 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 85,952 KB
最終ジャッジ日時 2024-04-30 17:18:04
合計ジャッジ時間 2,502 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,688 KB
testcase_01 AC 37 ms
52,140 KB
testcase_02 AC 36 ms
52,412 KB
testcase_03 AC 47 ms
61,068 KB
testcase_04 AC 81 ms
78,948 KB
testcase_05 AC 40 ms
58,336 KB
testcase_06 AC 37 ms
52,236 KB
testcase_07 AC 145 ms
85,952 KB
testcase_08 AC 38 ms
53,812 KB
testcase_09 AC 36 ms
53,060 KB
testcase_10 AC 36 ms
53,320 KB
testcase_11 AC 47 ms
64,240 KB
testcase_12 AC 36 ms
52,308 KB
testcase_13 AC 53 ms
71,516 KB
testcase_14 AC 41 ms
59,396 KB
testcase_15 AC 51 ms
68,720 KB
testcase_16 AC 38 ms
51,876 KB
testcase_17 AC 38 ms
52,188 KB
testcase_18 AC 76 ms
77,412 KB
testcase_19 AC 52 ms
68,864 KB
testcase_20 AC 43 ms
58,892 KB
testcase_21 AC 43 ms
60,112 KB
testcase_22 AC 50 ms
64,956 KB
testcase_23 AC 40 ms
58,040 KB
testcase_24 AC 43 ms
60,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 10 ** 9 + 7

N, S, K = map(int, input().split())

S -= K * N * (N - 1) // 2

if S < 0:
    print(0)
    
else:
    dp = [0] * (S + 1)
    
    dp[0] = 1
    
    for i in range(N, 1, -1):
        for j in range(i, S + 1):
            dp[j] += dp[j - i]
            
    print(sum(dp) % P)
0