結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
![]() |
提出日時 | 2015-10-31 19:53:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 632 ms |
コンパイル使用メモリ | 59,452 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 06:30:43 |
合計ジャッジ時間 | 1,916 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 10 WA * 12 |
ソースコード
#include<cstdio> #include<vector> #include<algorithm> #include<iostream> #include<cassert> #include<cstring> using namespace std; typedef pair<int,int>pint; typedef vector<int>vint; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);i++) template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;} const int mod=1000000007; int dp[20001]; int N,S,K; int main(){ cin>>N>>S>>K; S-=K*N*(N-1)/2; if(S<0){ cout<<0<<endl; return 0; } dp[0]=1; rep(i,N){ int tmp=N-i; for(int j=0;j+tmp<=S;j++){ dp[j+tmp]+=dp[j]; dp[j]%=mod; } } cout<<dp[S]<<endl; return 0; }