結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
![]() |
提出日時 | 2018-07-04 15:22:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4,418 ms / 5,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 1,855 ms |
コンパイル使用メモリ | 166,964 KB |
実行使用メモリ | 19,328 KB |
最終ジャッジ日時 | 2024-07-16 02:05:01 |
合計ジャッジ時間 | 17,807 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define int ll typedef pair<int,int> pii; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define all(a) (a).begin(),(a).end() #define pb emplace_back const ll MOD = 1e9+7; signed main(){ int n,s,k; cin>>n>>s>>k; s -= n*(n-1)/2*k; static int dp[101][20001]; rep(i,101)rep(j,20001)dp[i][j] = 0; dp[0][0] = 1; for(int i=1;i<=n;i++){ for(int j=0;j<=s;j++){ for(int value=0;;value++){ int remain = n-i+1; if(j-remain*value<0)break; (dp[i][j] += dp[i-1][j-remain*value])%=MOD; } } } cout<<dp[n][s]<<endl; }