結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
|
提出日時 | 2018-05-10 18:11:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 27 ms / 5,000 ms |
コード長 | 718 bytes |
コンパイル時間 | 517 ms |
コンパイル使用メモリ | 62,004 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-07-16 02:03:12 |
合計ジャッジ時間 | 1,405 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <cstdio> #include <queue> #include <stack> using namespace std; const long INF = 1000000007; template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } int dp[20030][200]; int main(){ int N,S,K; cin >> N >> S >> K; dp[0][0] = 1; if(S<K*N*(N-1)/2){ cout << 0 << endl; }else{ S = S-K*N*(N-1)/2; for(int i=0;i<=S;++i){ for(int j=1;j<=N;++j){ if(i-j>=0){ dp[i][j] = (dp[i][j-1]+dp[i-j][j]) % INF; }else{ dp[i][j] = dp[i][j-1] % INF; } } } cout << dp[S][N] << endl; } }