結果

問題 No.269 見栄っ張りの募金活動
ユーザー kotatsugamekotatsugame
提出日時 2020-02-28 06:37:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 351 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 64,628 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-04-21 17:25:25
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 21 ms
9,216 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 56 ms
19,200 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 6 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 8 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 7 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 20 ms
9,216 KB
testcase_19 AC 7 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 6 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-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