結果

問題 No.269 見栄っ張りの募金活動
ユーザー 藤原正貴藤原正貴
提出日時 2020-04-22 19:07:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 419 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 277,296 KB
最終ジャッジ日時 2024-04-20 04:21:10
合計ジャッジ時間 2,610 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,192 KB
testcase_01 AC 34 ms
52,504 KB
testcase_02 AC 34 ms
52,632 KB
testcase_03 AC 52 ms
67,252 KB
testcase_04 AC 144 ms
118,256 KB
testcase_05 AC 38 ms
58,584 KB
testcase_06 AC 35 ms
53,020 KB
testcase_07 AC 419 ms
277,296 KB
testcase_08 AC 36 ms
52,748 KB
testcase_09 AC 34 ms
52,596 KB
testcase_10 AC 34 ms
52,992 KB
testcase_11 AC 52 ms
68,476 KB
testcase_12 AC 35 ms
53,088 KB
testcase_13 AC 76 ms
84,868 KB
testcase_14 AC 41 ms
60,104 KB
testcase_15 AC 74 ms
84,932 KB
testcase_16 AC 35 ms
52,192 KB
testcase_17 AC 34 ms
52,112 KB
testcase_18 AC 156 ms
129,196 KB
testcase_19 AC 78 ms
83,980 KB
testcase_20 AC 39 ms
59,704 KB
testcase_21 AC 40 ms
59,808 KB
testcase_22 AC 55 ms
72,408 KB
testcase_23 AC 41 ms
60,792 KB
testcase_24 AC 39 ms
60,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,S,K = map(int,input().split())
S -= int(N*(N-1)/2*K)
dp = [[0]*(S+1) for _ in range(N+1)]
if S<0:
    print(0)
    exit()
if S == 0:
    print(1)
    exit()
dp[0][0] = 1
for i in range(1,N+1):
    for j in range(S+1):
        if j-i>=0:
            dp[i][j] = dp[i-1][j] + dp[i][j-i]
        else:
            dp[i][j] = dp[i-1][j]

print(dp[-1][-1]%(10**9+7))
0