結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
👑 ![]() |
提出日時 | 2020-12-08 14:25:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 58 ms / 5,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 2,175 ms |
コンパイル使用メモリ | 172,728 KB |
実行使用メモリ | 20,096 KB |
最終ジャッジ日時 | 2024-09-17 14:38:45 |
合計ジャッジ時間 | 3,203 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; ll I=167167167167; ll Q=1e9+7; vector<vector<ll>> vec2(ll a,ll b,ll syoki){ vector<vector<ll>> c(a,vector<ll>(b,syoki)); return c; } int main() { ll N,S,K; cin>>N>>S>>K; S-=(K*N*(N-1))/2; if(S<0){ cout<<"0"<<endl; return 0; } auto dp=vec2(S+2*N,N+2,0); dp[0][0]=1; for(int i=0;i<=S;i++){ for(int j=0;j<=N;j++){ dp[i][j]%=Q; if(j!=0) dp[i+j][j]+=dp[i][j]; dp[i][j+1]+=dp[i][j]; } } cout<<dp[S][N]<<endl; }