結果

問題 No.269 見栄っ張りの募金活動
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-06-23 00:00:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 91,224 KB
最終ジャッジ日時 2023-09-12 18:08:11
合計ジャッジ時間 3,655 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,176 KB
testcase_01 AC 69 ms
71,412 KB
testcase_02 AC 71 ms
71,240 KB
testcase_03 AC 83 ms
76,496 KB
testcase_04 AC 92 ms
76,752 KB
testcase_05 AC 77 ms
76,600 KB
testcase_06 AC 70 ms
71,408 KB
testcase_07 AC 126 ms
91,224 KB
testcase_08 AC 70 ms
71,204 KB
testcase_09 AC 70 ms
71,276 KB
testcase_10 AC 70 ms
71,176 KB
testcase_11 AC 79 ms
76,472 KB
testcase_12 AC 68 ms
71,052 KB
testcase_13 AC 78 ms
76,396 KB
testcase_14 AC 77 ms
76,560 KB
testcase_15 AC 81 ms
76,640 KB
testcase_16 AC 70 ms
71,340 KB
testcase_17 AC 71 ms
71,048 KB
testcase_18 AC 91 ms
76,672 KB
testcase_19 AC 83 ms
76,512 KB
testcase_20 AC 80 ms
76,428 KB
testcase_21 AC 79 ms
76,252 KB
testcase_22 AC 80 ms
76,376 KB
testcase_23 AC 76 ms
76,196 KB
testcase_24 AC 80 ms
76,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

https://yukicoder.me/problems/no/269

0,K,2K, ... , (N-1)K
を引いておけばok

"""

import sys
from sys import stdin

N,S,K = map(int,stdin.readline().split())

mod = 10**9+7

S -= (N-1)*K*N //2

if S < 0:
    print (0)
    sys.exit()

P = [[0] * (N+1) for i in range(S+1)]

for i in range(S+1):

    for j in range(N+1):

        if i == j == 0:
            P[i][j] = 1
        elif j == 0:
            P[i][j] = 0
        elif i-j >= 0:
            P[i][j] = P[i][j-1] + P[i-j][j]
        else:
            P[i][j] = P[i][j-1]

        P[i][j] %= mod

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