結果

問題 No.269 見栄っ張りの募金活動
ユーザー fumiphys
提出日時 2018-08-18 17:16:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 843 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 71,432 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-07-16 02:07:02
合計ジャッジ時間 1,343 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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