結果

問題 No.269 見栄っ張りの募金活動
ユーザー fumiphysfumiphys
提出日時 2018-07-04 20:06:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 543 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 59,792 KB
実行使用メモリ 11,252 KB
最終ジャッジ日時 2023-09-23 01:31:00
合計ジャッジ時間 1,567 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 10 ms
10,636 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 18 ms
11,252 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 9 ms
9,420 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 6 ms
7,432 KB
testcase_14 AC 11 ms
11,212 KB
testcase_15 AC 6 ms
9,556 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,384 KB
testcase_18 AC 8 ms
7,452 KB
testcase_19 AC 6 ms
7,436 KB
testcase_20 AC 5 ms
6,036 KB
testcase_21 AC 9 ms
9,892 KB
testcase_22 AC 5 ms
7,556 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 7 ms
7,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

#define ll long long int

using namespace std;

const int mod = 1e9 + 7;

int dp[20001][101];

int main(int argc, char const* argv[])
{
	int n, s, k;
	cin >> n >> s >> k;
	s -= k * (n - 1) * n / 2;
	if(s < 0){
			cout << 0 << endl;
			return 0;
	}
	for(int i = 0; i <= n; i++)dp[0][i] = 1;
	for(int i = 1; i <= s; i++){
			for(int j = 1; j <= n; j++){
					if(i >= j)dp[i][j] = int(((ll)dp[i-j][j] + (ll)dp[i][j-1]) % mod);
					else dp[i][j] = dp[i][j-1];
			}
	}
	cout << dp[s][n] << endl;
	return 0;
}
0