結果

問題 No.269 見栄っ張りの募金活動
ユーザー a0171610a0171610
提出日時 2020-03-20 16:27:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 417 bytes
コンパイル時間 1,720 ms
コンパイル使用メモリ 166,292 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-05-08 07:00:28
合計ジャッジ時間 2,937 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 23 ms
8,960 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 60 ms
19,072 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 10 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 9 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 23 ms
8,960 KB
testcase_19 AC 8 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 4 ms
5,376 KB
testcase_22 AC 7 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 5 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int N, S, K;
long mod=1e9+7,dp[101][20001];

int main(){
	cin >> N >> S >> K;
	for(int i = 0; i < N; i++) S -= i*K;
	if(S < 0){
		cout << 0 << endl;
	}
	dp[0][0]=1;
	for(int i = 0;i <= N; i++){
    for(int j = 0;j <= S; j++){
		  if(i < N) (dp[i + 1][j] += dp[i][j])%=mod;
		  if(i > 0 && i + j <= S) (dp[i][i + j] += dp[i][j])%=mod;
    }
	}
	cout << dp[N][S] << endl;
}
0