結果

問題 No.269 見栄っ張りの募金活動
ユーザー AEnAEn
提出日時 2023-05-27 01:51:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 399 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 92,168 KB
最終ジャッジ日時 2023-08-26 15:12:26
合計ジャッジ時間 3,919 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,464 KB
testcase_01 AC 67 ms
71,176 KB
testcase_02 AC 71 ms
71,376 KB
testcase_03 AC 76 ms
76,216 KB
testcase_04 AC 93 ms
82,016 KB
testcase_05 AC 70 ms
76,284 KB
testcase_06 AC 66 ms
71,364 KB
testcase_07 AC 130 ms
92,168 KB
testcase_08 AC 67 ms
71,648 KB
testcase_09 AC 65 ms
71,384 KB
testcase_10 AC 64 ms
71,308 KB
testcase_11 AC 77 ms
76,156 KB
testcase_12 AC 67 ms
71,636 KB
testcase_13 AC 79 ms
76,248 KB
testcase_14 AC 74 ms
76,780 KB
testcase_15 AC 78 ms
76,296 KB
testcase_16 AC 68 ms
71,104 KB
testcase_17 AC 68 ms
71,264 KB
testcase_18 AC 89 ms
76,360 KB
testcase_19 AC 78 ms
76,356 KB
testcase_20 AC 75 ms
76,228 KB
testcase_21 AC 75 ms
76,376 KB
testcase_22 AC 77 ms
76,260 KB
testcase_23 AC 71 ms
76,324 KB
testcase_24 AC 76 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

mod = 10**9+7
S -= K*N*(N-1)//2
if S<0:
    print(0)
elif S==0:
    print(1)
else:
    dp = [0]*(S+1)
    dp[0] = 1
    for i in range(N,0,-1):
        ndp = [0]*(S+1)
        sm = [0]*i
        for j in range(S+1):
            sm[j%i] += dp[j]
            sm[j%i] %= mod
            ndp[j] += sm[j%i]
            ndp[j] %= mod
        dp = ndp
    print(dp[-1])
0