結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 15 ms
7,764 KB
testcase_02 AC 15 ms
7,804 KB
testcase_03 AC 36 ms
7,708 KB
testcase_04 AC 280 ms
8,752 KB
testcase_05 AC 16 ms
7,808 KB
testcase_06 AC 16 ms
7,864 KB
testcase_07 AC 773 ms
8,928 KB
testcase_08 AC 15 ms
7,792 KB
testcase_09 AC 15 ms
7,800 KB
testcase_10 AC 16 ms
7,796 KB
testcase_11 AC 67 ms
8,824 KB
testcase_12 AC 15 ms
7,824 KB
testcase_13 AC 98 ms
8,204 KB
testcase_14 AC 22 ms
8,820 KB
testcase_15 AC 90 ms
8,492 KB
testcase_16 AC 16 ms
7,796 KB
testcase_17 AC 15 ms
7,912 KB
testcase_18 AC 269 ms
8,360 KB
testcase_19 AC 90 ms
8,332 KB
testcase_20 AC 27 ms
8,220 KB
testcase_21 AC 27 ms
8,740 KB
testcase_22 AC 63 ms
8,260 KB
testcase_23 AC 22 ms
7,788 KB
testcase_24 AC 34 ms
8,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,s,k=map(int,input().split())
mod=10**9+7
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