結果

問題 No.269 見栄っ張りの募金活動
ユーザー fiordfiord
提出日時 2015-08-23 23:47:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 23 ms / 5,000 ms
コード長 391 bytes
コンパイル時間 1,111 ms
コンパイル使用メモリ 144,648 KB
実行使用メモリ 19,080 KB
最終ジャッジ日時 2023-09-23 01:11:04
合計ジャッジ時間 2,268 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 4 ms
4,656 KB
testcase_04 AC 10 ms
9,272 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 23 ms
19,080 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 11 ms
10,564 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 4 ms
4,892 KB
testcase_12 AC 9 ms
9,024 KB
testcase_13 AC 4 ms
5,364 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 5 ms
5,280 KB
testcase_16 AC 9 ms
8,504 KB
testcase_17 AC 3 ms
4,520 KB
testcase_18 AC 15 ms
13,292 KB
testcase_19 AC 5 ms
5,952 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,476 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll E=1e9+7;
ll dp[100][20001];
int main(){
	int n,s,k;	cin>>n>>s>>k;
	for(int i=0;i*n<=s;i++)	dp[0][i*n]=1;
	for(int i=1;i<n;i++){
		for(int j=0;j<=s;j++){
			if(j-k*(n-i)>=0)	dp[i][j]+=dp[i-1][j-k*(n-i)];
			if(j-(n-i)>=0)	dp[i][j]+=dp[i][j-(n-i)];
			dp[i][j]%=E;
		}
	}
	cout<<dp[n-1][s]%E<<endl;
	return 0;
}
0