結果

問題 No.269 見栄っ張りの募金活動
ユーザー pekempeypekempey
提出日時 2015-08-21 23:22:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 693 bytes
コンパイル時間 1,152 ms
コンパイル使用メモリ 144,252 KB
実行使用メモリ 19,572 KB
最終ジャッジ日時 2023-09-23 01:05:16
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
11,760 KB
testcase_04 AC 5 ms
11,280 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 5 ms
17,740 KB
testcase_07 AC 9 ms
19,572 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 3 ms
4,652 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
8,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
6,480 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 5 ms
14,668 KB
testcase_19 AC 3 ms
8,364 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
5,940 KB
testcase_23 AC 2 ms
5,532 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a) rep2 (i, 0, a)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a) repr2 (i, 0, a)
#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define asn(a, b, c) fill_n(&(b), sizeof(a) / sizeof(b), c)
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;

ll N, S, K;
ll dp[111][20202];

int main() {
	cin >> N >> S >> K;
	ll T = S - K * N * (N - 1) / 2;

	dp[0][0] = 1;
	rep2 (i, 1, N + 1) {
		rep (j, T + 1) {
			if (j - i >= 0) {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - i]) % mod;
			} else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}

	ll ans = dp[N][T];
	cout << ans << endl;

	return 0;
}
0