結果

問題 No.269 見栄っ張りの募金活動
ユーザー lyosika43lyosika43
提出日時 2018-09-16 19:09:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 692 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 73,120 KB
実行使用メモリ 11,072 KB
最終ジャッジ日時 2024-07-16 02:08:00
合計ジャッジ時間 1,556 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int dp[105][20005];

int N,S,K;

int main()
{
	scanf("%d%d%d",&N,&S,&K);
	int T = S-K*N*(N-1)/2;
	if(T<0){
		printf("0\n");
		return 0;
	}
	dp[0][0]=1;
	for(int i=1;i<=N;i++){
		for(int j=0;j<=T;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];
			}
		}
	}
	printf("%d\n",dp[N][T]);
	return 0;
}
0