結果

問題 No.269 見栄っ張りの募金活動
ユーザー takakintakakin
提出日時 2020-05-11 22:02:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 785 ms / 5,000 ms
コード長 294 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 9,116 KB
最終ジャッジ日時 2023-09-26 12:12:53
合計ジャッジ時間 3,369 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,432 KB
testcase_01 AC 18 ms
8,284 KB
testcase_02 AC 18 ms
8,372 KB
testcase_03 AC 39 ms
8,276 KB
testcase_04 AC 287 ms
9,024 KB
testcase_05 AC 18 ms
8,444 KB
testcase_06 AC 18 ms
8,260 KB
testcase_07 AC 785 ms
9,116 KB
testcase_08 AC 18 ms
8,304 KB
testcase_09 AC 18 ms
8,388 KB
testcase_10 AC 18 ms
8,292 KB
testcase_11 AC 68 ms
8,892 KB
testcase_12 AC 18 ms
8,392 KB
testcase_13 AC 100 ms
8,624 KB
testcase_14 AC 25 ms
9,116 KB
testcase_15 AC 90 ms
8,708 KB
testcase_16 AC 19 ms
8,292 KB
testcase_17 AC 18 ms
8,240 KB
testcase_18 AC 276 ms
8,660 KB
testcase_19 AC 94 ms
8,476 KB
testcase_20 AC 28 ms
8,684 KB
testcase_21 AC 29 ms
8,772 KB
testcase_22 AC 64 ms
8,580 KB
testcase_23 AC 23 ms
8,316 KB
testcase_24 AC 37 ms
8,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,s,k=map(int,input().split())
mod=10**9+7
import copy
s-=n*(n-1)//2*k
if s<0:
  print(0)
else:
  DP=[1]*(s+1)
  for i in range(2,n+1):
    for j in range(i,s+1):
      DP[j]+=DP[j-i]
      if DP[j]>mod:
        DP[j]%=mod

  print(DP[s])
0