結果

問題 No.269 見栄っ張りの募金活動
ユーザー tnoda_tnoda_
提出日時 2015-08-28 16:41:51
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,861 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 67,512 KB
最終ジャッジ日時 2023-09-23 01:12:00
合計ジャッジ時間 8,342 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,964 KB
testcase_01 AC 11 ms
5,888 KB
testcase_02 AC 28 ms
5,972 KB
testcase_03 AC 143 ms
8,740 KB
testcase_04 AC 705 ms
27,892 KB
testcase_05 AC 13 ms
5,892 KB
testcase_06 AC 12 ms
5,948 KB
testcase_07 AC 1,861 ms
67,512 KB
testcase_08 AC 12 ms
5,864 KB
testcase_09 AC 794 ms
15,428 KB
testcase_10 AC 14 ms
6,112 KB
testcase_11 AC 177 ms
10,592 KB
testcase_12 AC 614 ms
11,864 KB
testcase_13 AC 230 ms
12,796 KB
testcase_14 AC 31 ms
6,444 KB
testcase_15 AC 213 ms
12,156 KB
testcase_16 AC 566 ms
12,780 KB
testcase_17 AC 115 ms
6,816 KB
testcase_18 AC 1,136 ms
34,944 KB
testcase_19 AC 290 ms
13,444 KB
testcase_20 AC 46 ms
6,912 KB
testcase_21 AC 43 ms
6,896 KB
testcase_22 AC 135 ms
9,772 KB
testcase_23 AC 34 ms
6,412 KB
testcase_24 AC 63 ms
7,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P = 10**9 + 7
N, S, K = map(int, raw_input().split())
dp = [[0] * (S+1) for i in xrange(N)]
for i in xrange(0, S+1, N):
    dp[0][i] = 1
for i in xrange(1, N):
    for j in xrange(0, S+1):
        if j-K*(N-i) >= 0:
            dp[i][j] += dp[i-1][j-K*(N-i)]
        if j-(N-i) >= 0:
            dp[i][j] += dp[i][j-(N-i)]
        dp[i][j] %= P
print(dp[N-1][S])
0