結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2016-02-27 12:06:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 1,130 bytes |
コンパイル時間 | 670 ms |
コンパイル使用メモリ | 74,488 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-07-16 01:52:34 |
合計ジャッジ時間 | 1,592 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <cstdio>#include <iostream>#include <algorithm>#include <complex>#include <queue>#include <map>#include <string>using namespace std;#define FOR(i,a,b) for (int i=(a);i<(b);i++)#define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--)#define REP(i,n) for (int i=0;i<(n);i++)#define RREP(i,n) for (int i=(n)-1;i>=0;i--)#define pb push_back#define ALL(a) (a).begin(),(a).end()#define PI 3.1415926535typedef long long ll;typedef pair<int, int> P;//typedef complex<double> C;const int MAX_N = 100;const int MAX_S = 20000;const ll mod = 1000000007;int N, S, K;ll dp[MAX_N][MAX_S + 1];void input() {cin >> N >> S >> K;}void solve() {int s = 0;while (s <= S) {dp[0][s] = 1;s += N;}FOR(i, 1, N) {// FOR(j, min(K * (N - i), (N - i)), S + 1) {// dp[i][j] = dp[i - 1][j - K * (N - i)] + dp[i][j - (N - i)];// dp[i][j] %= mod;// }REP(j, S + 1) {if (j - K * (N - i) >= 0)dp[i][j] += dp[i - 1][j - K * (N - i)];if (j - (N - i) >= 0)dp[i][j] += dp[i][j - (N - i)];dp[i][j] %= mod;}}cout << dp[N - 1][S] << endl;}int main() {input();solve();}