結果

問題 No.269 見栄っ張りの募金活動
ユーザー yamamura-kyamamura-k
提出日時 2020-03-11 15:03:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 26,752 KB
最終ジャッジ日時 2024-04-27 19:16:06
合計ジャッジ時間 3,292 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 WA -
testcase_02 AC 31 ms
10,880 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 240 ms
18,048 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 199 ms
16,384 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 187 ms
15,872 KB
testcase_17 AC 57 ms
11,776 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9+7
def main():
    N,S,K = map(int,input().split())
    dp = [[0 for _ in range(S+1)] for _ in range(N)]
    dp[0][0] = 1
    for i in range(N):
        for j in range(S+1):
            if j >= K*(N-i):
                dp[i][j] = (dp[i][j-(N-i)]+dp[i-1][j-K*(N-i)])%mod
            elif j >= N-i:
                dp[i][j] = dp[i][j-N+i]%mod
            else:
                dp[i][j] = dp[i-1][j]%mod
    print(dp[-1][-1]%mod)
if __name__ == '__main__':
    main()
0