結果

問題 No.269 見栄っ張りの募金活動
ユーザー tassei903tassei903
提出日時 2022-12-14 09:22:14
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 958 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 87,644 KB
最終ジャッジ日時 2024-04-25 14:34:27
合計ジャッジ時間 11,988 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,688 KB
testcase_01 AC 36 ms
52,344 KB
testcase_02 AC 49 ms
63,188 KB
testcase_03 AC 71 ms
67,048 KB
testcase_04 AC 4,577 ms
79,524 KB
testcase_05 AC 44 ms
60,752 KB
testcase_06 AC 37 ms
53,960 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n,s,k = na()
dp = [0] * (s+1)
dp[0] = 1
mod = 10**9+7
ndp = [0] * (s+1)
dp,ndp = ndp,dp
i = 0
for j in range(s+1):
    if ndp[j] == 0:
        continue
    for x in range(0, s+1):
        nj = j + x * (n - i)
        if nj > s:
            break
        dp[nj] += ndp[j]
        dp[nj] %= mod
for i in range(1,n):
    ndp = [0] * (s+1)
    dp,ndp = ndp,dp
    for j in range(s+1):
        if ndp[j] == 0:
            continue
        for x in range(k, s+1):
            nj = j + x * (n - i)
            if nj > s:
                break
            dp[nj] += ndp[j]
            dp[nj] %= mod
print(dp[-1])
0