結果

問題 No.269 見栄っ張りの募金活動
ユーザー onechankeidansionechankeidansi
提出日時 2019-03-09 02:20:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 511 bytes
コンパイル時間 1,418 ms
コンパイル使用メモリ 163,204 KB
実行使用メモリ 19,388 KB
最終ジャッジ日時 2023-09-05 19:47:48
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
19,016 KB
testcase_01 AC 10 ms
19,148 KB
testcase_02 AC 10 ms
19,048 KB
testcase_03 AC 10 ms
19,176 KB
testcase_04 AC 10 ms
19,116 KB
testcase_05 AC 10 ms
19,388 KB
testcase_06 AC 10 ms
19,188 KB
testcase_07 AC 10 ms
19,112 KB
testcase_08 AC 10 ms
19,256 KB
testcase_09 AC 11 ms
19,132 KB
testcase_10 AC 10 ms
19,172 KB
testcase_11 AC 10 ms
19,172 KB
testcase_12 AC 11 ms
19,128 KB
testcase_13 AC 10 ms
19,232 KB
testcase_14 AC 11 ms
19,172 KB
testcase_15 AC 10 ms
19,320 KB
testcase_16 AC 10 ms
19,048 KB
testcase_17 AC 11 ms
19,104 KB
testcase_18 AC 11 ms
19,356 KB
testcase_19 AC 11 ms
19,208 KB
testcase_20 AC 11 ms
19,248 KB
testcase_21 AC 11 ms
19,184 KB
testcase_22 AC 10 ms
19,108 KB
testcase_23 AC 10 ms
19,112 KB
testcase_24 AC 11 ms
19,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const long long MOD = 1000000007;
long long dp[101][20001];


int main(){
	long long N, S ,K;
	scanf("%lld",&N);
	scanf("%lld",&S);
	scanf("%lld",&K);

	dp[0][0] = 1;

	for (int i = 1; i <= 100; i++) {
		for (int j = 0; j <= 20000; j++) {
			if (j - i >= 0) {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - i]) % MOD;
			} else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}

	if (S-(N-1)*N*K/2 >= 0) printf("%lld\n", dp[N][S-(N-1)*N*K/2]); else printf("0\n");
	return 0;
}
0