結果

問題 No.269 見栄っ張りの募金活動
ユーザー fumiphysfumiphys
提出日時 2018-08-18 17:16:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 843 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 71,580 KB
実行使用メモリ 19,124 KB
最終ジャッジ日時 2023-09-23 01:33:14
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 16 ms
18,080 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 18 ms
19,124 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 12 ms
15,568 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 8 ms
10,300 KB
testcase_14 AC 17 ms
19,080 KB
testcase_15 AC 11 ms
13,592 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 9 ms
11,528 KB
testcase_19 AC 7 ms
9,540 KB
testcase_20 AC 7 ms
8,524 KB
testcase_21 AC 16 ms
17,676 KB
testcase_22 AC 8 ms
9,424 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 11 ms
13,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;
const int mod = 1e9 + 7;
int n, s, k;
ll dp[20001][101];

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