結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
|
提出日時 | 2020-05-06 13:11:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 471 bytes |
コンパイル時間 | 1,858 ms |
コンパイル使用メモリ | 169,932 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-06-28 14:12:02 |
合計ジャッジ時間 | 2,501 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) #define pb push_back using namespace std; typedef long long ll; const int mod=1e9+7; int main(){ int n,s,k; cin>>n>>s>>k; s -= n*(n-1)*k/2; if(s<0){ cout << 0; return 0; } vector<vector<int>> dp(s+1,vector<int>(n+1)); dp[0][0]=1; rep(i,s+1)for(int j=1;j<n+1;j++){ if(j)dp[i][j]=dp[i][j-1]; if(i>=j) dp[i][j]+=dp[i-j][j]; dp[i][j]%=mod; } cout<<dp[s][n]; }