結果

問題 No.1011 Infinite Stairs
ユーザー kotatsugamekotatsugame
提出日時 2020-03-24 20:17:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 320 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 63,560 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 05:40:01
合計ジャッジ時間 3,936 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
using namespace std;
int N,d,K;
long dp[1500],mod=1e9+7;
main()
{
	cin>>N>>d>>K;
	dp[0]=1;
	for(int c=0;c<N;c++)
	{
		for(int j=K;j>=0;j--)
		{
			(dp[j+d+1]+=mod-dp[j])%=mod;
			(dp[j+1]+=dp[j])%=mod;
			dp[j]=0;
		}
		for(int j=1;j<=K;j++)
		{
			(dp[j]+=dp[j-1])%=mod;
		}
	}
	cout<<dp[K]<<endl;
}
0