結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2020-03-04 14:31:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 56 ms / 5,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 58,880 KB |
最終ジャッジ日時 | 2024-10-14 00:14:33 |
合計ジャッジ時間 | 2,342 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9 + 7 # %% N, S, K = map(int, read().split()) # %% base = K * N * (N - 1) // 2 if base > S: print(0) exit() # %% S -= base dp = [0] * (S + 1) dp[0] = 1 for x in range(1, N + 1): for n in range(x, S + 1): dp[n] += dp[n - x] dp[n] %= MOD print(dp[S])