結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
|
提出日時 | 2016-01-30 01:10:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,772 ms / 5,000 ms |
コード長 | 922 bytes |
コンパイル時間 | 686 ms |
コンパイル使用メモリ | 91,600 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-16 01:53:46 |
合計ジャッジ時間 | 10,272 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <cstdio>#include <iostream>#include <sstream>#include <fstream>#include <iomanip>#include <algorithm>#include <cmath>#include <string>#include <vector>#include <list>#include <queue>#include <stack>#include <set>#include <map>#include <bitset>#include <numeric>#include <limits>#include <climits>#include <cfloat>#include <functional>using namespace std;const int MOD = 1000000007;int main(){int n, s, d;cin >> n >> s >> d;vector<int> dp(s+1, 0);dp[0] = 1;for(int i=0; i<n; ++i){vector<int> nextDp(s+1, 0);for(int j=0; j<=s; ++j){for(int k=0; ; ++k){int a = j + d * (n - 1 - i) + (n - i) * k;if(a > s)break;nextDp[a] += dp[j];nextDp[a] %= MOD;}}dp.swap(nextDp);}cout << dp[s] << endl;return 0;}