結果

問題 No.269 見栄っ張りの募金活動
ユーザー airisairis
提出日時 2015-08-24 23:25:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 1,256 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 76,008 KB
実行使用メモリ 19,240 KB
最終ジャッジ日時 2023-09-23 01:11:43
合計ジャッジ時間 1,713 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,644 KB
testcase_04 AC 12 ms
9,356 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 26 ms
19,240 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 12 ms
10,596 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,912 KB
testcase_12 AC 10 ms
9,016 KB
testcase_13 AC 5 ms
5,436 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 5 ms
5,308 KB
testcase_16 AC 10 ms
8,492 KB
testcase_17 AC 3 ms
4,524 KB
testcase_18 AC 17 ms
13,260 KB
testcase_19 AC 6 ms
5,916 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 3 ms
4,524 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 0
	rep(i, 10 + 1) {
		rep(j, 10 + 1) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
#endif
	return 0;
}


0