結果

問題 No.269 見栄っ張りの募金活動
ユーザー asumo0729asumo0729
提出日時 2021-04-22 21:25:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 612 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 92,252 KB
最終ジャッジ日時 2023-09-17 10:21:41
合計ジャッジ時間 3,429 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,408 KB
testcase_01 AC 74 ms
71,408 KB
testcase_02 AC 74 ms
71,384 KB
testcase_03 AC 85 ms
76,560 KB
testcase_04 AC 96 ms
82,052 KB
testcase_05 AC 79 ms
76,536 KB
testcase_06 AC 75 ms
71,380 KB
testcase_07 AC 119 ms
92,252 KB
testcase_08 AC 73 ms
71,484 KB
testcase_09 AC 76 ms
71,552 KB
testcase_10 AC 74 ms
71,208 KB
testcase_11 AC 84 ms
76,320 KB
testcase_12 AC 75 ms
71,496 KB
testcase_13 AC 84 ms
76,344 KB
testcase_14 AC 81 ms
77,000 KB
testcase_15 AC 83 ms
76,272 KB
testcase_16 AC 75 ms
71,204 KB
testcase_17 AC 73 ms
71,448 KB
testcase_18 AC 90 ms
76,280 KB
testcase_19 AC 84 ms
76,324 KB
testcase_20 AC 84 ms
76,288 KB
testcase_21 AC 81 ms
76,308 KB
testcase_22 AC 86 ms
76,372 KB
testcase_23 AC 78 ms
76,428 KB
testcase_24 AC 86 ms
76,304 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 - i) >= 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