結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
![]() |
提出日時 | 2015-08-24 23:25:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 26 ms / 5,000 ms |
コード長 | 1,256 bytes |
コンパイル時間 | 725 ms |
コンパイル使用メモリ | 80,448 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-07-16 01:48:30 |
合計ジャッジ時間 | 1,547 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream>#include <algorithm>#include <string>#include <vector>#include <queue>#include <stack>#include <set>#include <map>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <numeric>#include <bitset>#include <complex>#define rep(x, to) for (int x = 0; x < (to); x++)#define REP(x, a, to) for (int x = (a); x < (to); x++)#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)#define EPS (1e-14)using namespace std;typedef long long ll;typedef pair<int, int> PII;typedef pair<ll, ll> PLL;typedef complex<double> Complex;typedef vector< vector<int> > Mat;const ll mod = (ll)(1e+9 + 7);ll N, S, K;ll dp[205][20005];void solve() {for (int i = 0; i <= S; i += N) {dp[1][i] = 1;}for (int i = 1; i < N; i++) {for (int j = 0; j <= S; j++) {if (j - (N - i) >= 0) {dp[i + 1][j] += dp[i + 1][j - (N - i)];dp[i + 1][j] %= mod;}if (j - (N - i) * K >= 0) {dp[i + 1][j] += dp[i][j - (N - i) * K];dp[i + 1][j] %= mod;}}}cout << dp[N][S] << endl;}int main() {cin >> N >> S >> K;solve();#if 0rep(i, 10 + 1) {rep(j, 10 + 1) {cout << dp[i][j] << " ";}cout << endl;}#endifreturn 0;}