結果

問題 No.269 見栄っ張りの募金活動
ユーザー takin6takin6
提出日時 2020-05-18 14:12:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 316 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 88,960 KB
最終ジャッジ日時 2024-04-09 21:28:08
合計ジャッジ時間 3,692 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 51 ms
13,056 KB
testcase_04 AC 365 ms
38,016 KB
testcase_05 AC 26 ms
10,880 KB
testcase_06 AC 24 ms
10,752 KB
testcase_07 AC 928 ms
88,960 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 25 ms
10,880 KB
testcase_10 WA -
testcase_11 AC 86 ms
16,384 KB
testcase_12 AC 25 ms
10,752 KB
testcase_13 AC 125 ms
19,456 KB
testcase_14 AC 33 ms
11,776 KB
testcase_15 AC 116 ms
18,560 KB
testcase_16 AC 25 ms
10,880 KB
testcase_17 AC 25 ms
10,752 KB
testcase_18 AC 366 ms
37,376 KB
testcase_19 AC 112 ms
18,304 KB
testcase_20 AC 41 ms
12,032 KB
testcase_21 AC 41 ms
12,288 KB
testcase_22 AC 90 ms
15,616 KB
testcase_23 AC 31 ms
11,264 KB
testcase_24 AC 50 ms
13,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,s,k = map(int, input().split())
mod = 10**9+7
s -= (n*(n-1)//2)*k
if s <= 0:
  print(0)
  exit()

dp = [ [1]*(s+1) for _ in range(n+1) ]

for i in range(2, n+1):
  for j in range(s+1):
    if j >= i:
      dp[i][j] = (dp[i-1][j] + dp[i][j-i]) % mod
    else:
      dp[i][j] = (dp[i-1][j]) % mod

print(dp[-1][-1])
0