結果

問題 No.269 見栄っ張りの募金活動
ユーザー Kmcode1Kmcode1
提出日時 2015-08-21 22:58:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 1,115 bytes
コンパイル時間 1,403 ms
コンパイル使用メモリ 89,680 KB
実行使用メモリ 21,240 KB
最終ジャッジ日時 2023-09-23 01:02:47
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
5,648 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
13,996 KB
testcase_04 AC 12 ms
11,880 KB
testcase_05 AC 3 ms
7,940 KB
testcase_06 AC 5 ms
20,448 KB
testcase_07 AC 31 ms
21,240 KB
testcase_08 AC 2 ms
7,652 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 3 ms
7,596 KB
testcase_11 AC 4 ms
7,680 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 6 ms
9,728 KB
testcase_14 AC 2 ms
5,600 KB
testcase_15 AC 6 ms
9,756 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 13 ms
18,224 KB
testcase_19 AC 6 ms
11,920 KB
testcase_20 AC 3 ms
7,924 KB
testcase_21 AC 3 ms
7,644 KB
testcase_22 AC 4 ms
9,836 KB
testcase_23 AC 3 ms
9,816 KB
testcase_24 AC 3 ms
7,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;

int n;
int s;
int k;
long long int dp[102][20002];
long long int mod[102][20002];
#define MOD 1000000007
int main(){
	scanf("%d%d%d", &n, &s, &k);
	long long int N = n;
	long long int K = k;
	long long int kkk = (long long int)(K + N*K-K) *(long long int)(n-1) / 2LL;
	if (kkk > (long long int)(s)){
		puts("0");
		return 0;
	}
	s -= kkk;
	for (int i = 0; i <= s; i++){
		if (i*n > s){
			break;
		}
		dp[0][i*n] = 1;
	}
	for (int i = 0; i+1 < n; i++){
		long long int rest = n - i - 1;
		for (int j = 0; j <= s; j++){
			mod[i][j%rest] += dp[i][j];
			mod[i][j%rest] %= MOD;
			dp[i + 1][j] = mod[i][j%rest];
		}
	}
	printf("%lld\n", dp[n - 1][s]);
	return 0;
}
0