結果

問題 No.269 見栄っ張りの募金活動
ユーザー HoneyMackHoneyMack
提出日時 2021-09-12 13:32:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 1,354 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 83,664 KB
実行使用メモリ 11,456 KB
最終ジャッジ日時 2023-09-06 07:25:48
合計ジャッジ時間 2,068 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 9 ms
7,056 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 24 ms
11,456 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 9 ms
7,168 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 5 ms
5,004 KB
testcase_12 AC 7 ms
6,304 KB
testcase_13 AC 4 ms
4,640 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 4 ms
4,668 KB
testcase_16 AC 7 ms
6,108 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 12 ms
8,856 KB
testcase_19 AC 4 ms
4,900 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>

using namespace std;

using ll = long long;
using pii = pair<int, int>;	using pll = pair<ll, ll>;	using pil = pair<int, ll>;	using pli = pair<ll, int>;
using vi = vector<int>;		using vvi = vector<vi>;		using vvvi = vector<vvi>;
using vll = vector<ll>;		using vvll = vector<vll>;	using vvvll = vector<vvll>;
using vb = vector<bool>;	using vvb = vector<vb>;		using vvvb = vector<vvb>;
template <class T> using pqr = priority_queue<T, vector<T>, greater<T>>;

const ll INFL = (ll)1e18;	const int INF = (int)1e9;
const int MOD = 1000000007;

template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; } // 最大値を更新(更新されたら true を返す)
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; } // 最小値を更新(更新されたら true を返す)


int main() {
	int N, S, K;
	cin >> N >> S >> K;

	vvi DP(S + 1, vi(N + 1, 0));
	for (int i = 0; i <= S; i++)
		DP[i][1] = 1;

	for (int i = 0; i <= S; i++) {
		for (int j = 2; j <= N; j++) {
			if (i - j >= 0)
				DP[i][j] += DP[i - j][j];
			if (i - K * (j - 1) >= 0)
				DP[i][j] += DP[i - K * (j - 1)][j - 1];
			DP[i][j] %= MOD;
		}
	}

	cout << DP[S][N] << endl;


	return 0;
}
0