結果

問題 No.269 見栄っ張りの募金活動
ユーザー なつねこなつねこ
提出日時 2022-02-25 22:39:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 5,000 ms
コード長 331 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 91,656 KB
最終ジャッジ日時 2023-09-16 17:49:51
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,948 KB
testcase_01 AC 71 ms
71,268 KB
testcase_02 AC 77 ms
76,100 KB
testcase_03 AC 81 ms
75,984 KB
testcase_04 AC 92 ms
81,860 KB
testcase_05 AC 78 ms
75,864 KB
testcase_06 AC 72 ms
71,328 KB
testcase_07 AC 112 ms
91,656 KB
testcase_08 AC 71 ms
71,428 KB
testcase_09 AC 90 ms
75,824 KB
testcase_10 AC 76 ms
76,076 KB
testcase_11 AC 81 ms
77,548 KB
testcase_12 AC 85 ms
76,012 KB
testcase_13 AC 80 ms
76,068 KB
testcase_14 AC 75 ms
76,392 KB
testcase_15 AC 80 ms
75,928 KB
testcase_16 AC 87 ms
76,084 KB
testcase_17 AC 78 ms
75,884 KB
testcase_18 AC 99 ms
85,680 KB
testcase_19 AC 83 ms
75,836 KB
testcase_20 AC 79 ms
75,868 KB
testcase_21 AC 78 ms
75,840 KB
testcase_22 AC 81 ms
76,084 KB
testcase_23 AC 79 ms
76,072 KB
testcase_24 AC 80 ms
75,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,S,K = map(int,input().split())
prev = (N**2-N)//2*K
mod = 10**9 + 7
DP = [[1 for j in range(S+1)] for i in range(N)]
for i in range(1,N):
  for j in range(S+1):
    if i < j:
      DP[i][j] = (DP[i][j-i-1] + DP[i-1][j])%mod
    else:
      DP[i][j] = DP[i-1][j]
#print(DP)
if prev > S:
  print('0')
else:
  print(DP[N-1][S-prev])
0