結果

問題 No.269 見栄っ張りの募金活動
ユーザー lyosika43lyosika43
提出日時 2018-09-16 19:09:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 692 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 72,244 KB
実行使用メモリ 11,120 KB
最終ジャッジ日時 2023-09-23 01:34:43
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
7,312 KB
testcase_04 AC 5 ms
6,992 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
9,200 KB
testcase_07 AC 8 ms
11,120 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
6,032 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 4 ms
8,160 KB
testcase_19 AC 3 ms
5,696 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,384 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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