結果

問題 No.269 見栄っ張りの募金活動
ユーザー ky_used_beforeky_used_before
提出日時 2020-02-20 01:17:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 87,936 KB
最終ジャッジ日時 2024-04-17 06:13:51
合計ジャッジ時間 6,337 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
11,136 KB
testcase_01 AC 32 ms
11,008 KB
testcase_02 AC 31 ms
11,008 KB
testcase_03 AC 143 ms
14,464 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 32 ms
11,008 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 32 ms
11,136 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 31 ms
11,136 KB
testcase_17 AC 31 ms
11,008 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 141 ms
16,384 KB
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
from collections import deque
import copy

MOD = 10 ** 9 + 7
N, S, K = map(int, input().split())
if N*K*N/2 > S:
    print(0)
    sys.exit()
dp = [[0 for _ in range(S + 10)] for _ in range(N + 10)]
dp[0] = [0 for _ in range(S + 10)]
for i in range(S + 10):
    if i * K * N >= S + 5:
        break
    dp[0][i * K * N] = 1
for i in range(1, N):
    for l in range(S + 1):
        if l - K * (N - i) >= 0:
            dp[i][l] = (dp[i][l - (N - i)] + dp[i - 1][l - K * (N - i)]) % MOD
        elif l - (N - i) >= 0:
            dp[i][l] = dp[i - 1][l - K * (N - i)] % MOD
print(dp[N - 1][S]%MOD)
0