結果

問題 No.269 見栄っ張りの募金活動
ユーザー asumo0729asumo0729
提出日時 2021-04-22 21:23:16
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 612 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 91,824 KB
最終ジャッジ日時 2023-09-17 10:20:27
合計ジャッジ時間 3,502 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,324 KB
testcase_01 AC 73 ms
71,376 KB
testcase_02 AC 72 ms
70,896 KB
testcase_03 AC 84 ms
76,144 KB
testcase_04 AC 94 ms
81,628 KB
testcase_05 AC 77 ms
76,024 KB
testcase_06 RE -
testcase_07 AC 117 ms
91,824 KB
testcase_08 AC 72 ms
71,056 KB
testcase_09 AC 73 ms
70,900 KB
testcase_10 AC 73 ms
71,396 KB
testcase_11 AC 83 ms
75,936 KB
testcase_12 AC 73 ms
71,328 KB
testcase_13 AC 83 ms
76,056 KB
testcase_14 AC 79 ms
76,468 KB
testcase_15 AC 84 ms
76,068 KB
testcase_16 AC 74 ms
71,048 KB
testcase_17 AC 73 ms
71,420 KB
testcase_18 AC 91 ms
76,108 KB
testcase_19 AC 84 ms
76,088 KB
testcase_20 AC 79 ms
75,900 KB
testcase_21 AC 79 ms
76,016 KB
testcase_22 AC 82 ms
76,192 KB
testcase_23 AC 76 ms
76,156 KB
testcase_24 AC 78 ms
76,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import itertools
stdin=sys.stdin

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')

N, S, K = lp()
rest = (N - 1) * N //2 * K
S -= rest

mod = 10 ** 9 + 7

ans = 0

dp = [[ 0 for _ in range(S + 1)] for _ in range(N + 1)]
if S < 0:
    print(0)
    sys.exit()
dp[0][0] = 1
for i in range(1,N + 1):
    for j in range(0, S + 1):
        if (j - 1) >= 0:
            dp[i][j] = (dp[i - 1][j] + dp[i][j - i])%mod
        else:
            dp[i][j] = dp[i - 1][j]

print(dp[N][S])
0