結果

問題 No.269 見栄っ張りの募金活動
ユーザー mlihua09mlihua09
提出日時 2020-09-01 19:58:41
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 177 ms / 5,000 ms
コード長 292 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 87,840 KB
最終ジャッジ日時 2023-08-12 22:16:05
合計ジャッジ時間 3,817 ms
ジャッジサーバーID
(参考情報)
judge2 / judge7
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,456 KB
testcase_01 AC 77 ms
71,456 KB
testcase_02 AC 76 ms
71,304 KB
testcase_03 AC 84 ms
76,368 KB
testcase_04 AC 114 ms
80,276 KB
testcase_05 AC 79 ms
75,516 KB
testcase_06 AC 76 ms
71,484 KB
testcase_07 AC 177 ms
87,840 KB
testcase_08 AC 76 ms
71,364 KB
testcase_09 AC 75 ms
71,144 KB
testcase_10 AC 76 ms
71,420 KB
testcase_11 AC 88 ms
76,136 KB
testcase_12 AC 76 ms
71,268 KB
testcase_13 AC 90 ms
76,076 KB
testcase_14 AC 78 ms
75,692 KB
testcase_15 AC 88 ms
76,192 KB
testcase_16 AC 76 ms
71,164 KB
testcase_17 AC 75 ms
71,396 KB
testcase_18 AC 108 ms
78,452 KB
testcase_19 AC 90 ms
76,520 KB
testcase_20 AC 80 ms
75,896 KB
testcase_21 AC 80 ms
75,668 KB
testcase_22 AC 87 ms
75,992 KB
testcase_23 AC 79 ms
75,716 KB
testcase_24 AC 81 ms
75,720 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