結果

問題 No.269 見栄っ張りの募金活動
ユーザー kotatsugamekotatsugame
提出日時 2020-02-28 06:37:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 64,372 KB
実行使用メモリ 18,992 KB
最終ジャッジ日時 2023-08-03 19:12:57
合計ジャッジ時間 2,348 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 23 ms
9,124 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 60 ms
18,992 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,504 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 6 ms
4,736 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 9 ms
5,244 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 8 ms
5,056 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 22 ms
9,164 KB
testcase_19 AC 8 ms
5,032 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 6 ms
4,524 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    5 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,S,K;
long mod=1e9+7,dp[101][20001];
main()
{
	cin>>N>>S>>K;
	for(int i=0;i<N;i++)S-=i*K;
	if(S<0)
	{
		cout<<0<<endl;
		return 0;
	}
	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