結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2022-09-02 00:08:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 100 ms / 5,000 ms |
コード長 | 483 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 82,580 KB |
実行使用メモリ | 78,704 KB |
最終ジャッジ日時 | 2024-11-14 16:28:20 |
合計ジャッジ時間 | 3,030 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
N,S,K=map(int,input().split()) DP=[0]*(S+1) DP[S]=1 mod=10**9+7 for i in range(N): NDP=[0]*(S+1) rest=N-i for j in range(S+1): if i==0: if DP[j]!=0: NDP[j]+=DP[j] else: if DP[j]!=0 and j-rest*K>=0: NDP[j-rest*K]+=DP[j] NDP[j-rest*K]%=mod for j in range(S,-1,-1): if j+rest<=S: NDP[j]+=NDP[j+rest] NDP[j]%=mod DP=NDP print(DP[0])