結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
![]() |
提出日時 | 2019-10-08 02:56:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 5,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 582 ms |
コンパイル使用メモリ | 66,740 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-10-15 16:33:12 |
合計ジャッジ時間 | 1,731 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<cstdio> #include<cstdlib> #include<algorithm> #include<iostream> #include<queue> #include<vector> #include <bitset> #include<math.h> using namespace std; #define INF 10000000 #define MOD 1000000007 typedef long long ll; typedef pair<ll,ll> P; //計算量はO(NM) //n個の区別できない物をm個以下に分割する方法 ll n,m; ll dp[200+1][20000+1]; void bunkatu(){ dp[0][0]=1; for(int i=1;i<=m;i++){ for(int j=0;j<=n;j++){ if(j-i>=0){ dp[i][j]=(dp[i-1][j]+dp[i][j-i])%MOD; }else{ dp[i][j]=dp[i-1][j]; } //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl; } } } int main(){ ll K; cin>>m>>n>>K; n-=(ll)K*m*(m-1)/2; if(n<0){ cout<<0<<endl; return 0; } //cout<<m<<" "<<n<<endl; bunkatu(); cout<<dp[m][n]<<endl; }