結果

問題 No.269 見栄っ張りの募金活動
ユーザー yurujirouyurujirou
提出日時 2021-09-23 15:35:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 1,217 bytes
コンパイル時間 2,154 ms
コンパイル使用メモリ 76,328 KB
実行使用メモリ 19,600 KB
最終ジャッジ日時 2023-09-18 19:53:47
合計ジャッジ時間 2,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
5,496 KB
testcase_03 AC 3 ms
11,820 KB
testcase_04 AC 6 ms
9,288 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 5 ms
17,792 KB
testcase_07 AC 11 ms
19,600 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 7 ms
18,716 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 3 ms
4,796 KB
testcase_12 AC 6 ms
16,564 KB
testcase_13 AC 3 ms
6,320 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 4 ms
6,512 KB
testcase_16 AC 5 ms
12,568 KB
testcase_17 AC 3 ms
9,732 KB
testcase_18 AC 7 ms
15,296 KB
testcase_19 AC 4 ms
8,468 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
5,924 KB
testcase_23 AC 2 ms
5,556 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>
using namespace std;

//#include <atcoder/all>
//using namespace atcoder;

#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define RREP(i,n) for(int i = (int)n-1; i >= 0; i--)
#define LREP(i,n) for(LL i = 0; i < (LL)n; i++)

#define Vi vector<int>
#define Vl vector<long long>
#define LP pair<long long ,long long>
#define P pair<int, int>
#define T3 tuple<LL, LL, LL>
#define T4 tuple<LL, LL, LL, LL>
#define INF 1000000007
#define SIZE	200010
#define MOD 1000000007
typedef long long LL;

int N, S, K;
LL dp[110][20010];

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

	dp[0][0] = 1;
	for (int i = 1; i < N; i++) {
		for (int s = 0; s <= S; s++) {
			dp[i][s] = dp[i - 1][s];
			if (s - i >= 0) dp[i][s] += dp[i][s - i];
			dp[i][s] %= MOD;
		}
	}

	LL ans = 0;
	for (int a = 0; a <= S; a++) {
		int s = S - N * a - N * (N - 1) * K / 2;
		if (s >= 0) ans = (ans + dp[N - 1][s]) % MOD;
	}
	cout << ans << endl;
}
0