結果

問題 No.269 見栄っ張りの募金活動
ユーザー CleyLCleyL
提出日時 2020-03-16 18:00:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,576 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 64,000 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-05-06 01:06:32
合計ジャッジ時間 6,056 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 6 ms
5,376 KB
testcase_04 AC 1,123 ms
6,400 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1,576 ms
11,264 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 466 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 205 ms
5,376 KB
testcase_14 AC 142 ms
5,376 KB
testcase_15 AC 299 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 317 ms
6,528 KB
testcase_19 AC 100 ms
5,376 KB
testcase_20 AC 66 ms
5,376 KB
testcase_21 AC 225 ms
5,376 KB
testcase_22 AC 76 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 188 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~

ソースコード

diff #

#include <iostream>
#include <ctime>
using namespace std;
const int mod = 1000000007;
int dp[101][20001];
main(){
	int n,s,k;cin>>n>>s>>k;
	s -= ((n+(n-1))/2)*((n+(n-1))/2+1)/2*k;
	dp[0][0] = 1;
	if(0>s){
		cout << 0 << endl;
		return 0;
	}
	for(int i = 0; n > i; i++){
		for(int j = 0; s >= j; j++){
			if(dp[i][j] != 0){
				for(int l = 0; s >= j+l*(n-i); l++)dp[i+1][j+l*(n-i)]=(dp[i+1][j+l*(n-i)]+dp[i][j])%mod;
			}
		}
	}
	cout << dp[n][s] << endl;
}
0