結果

問題 No.533 Mysterious Stairs
ユーザー TAISA_TAISA_
提出日時 2018-06-08 23:07:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 1,784 ms
コンパイル使用メモリ 144,020 KB
実行使用メモリ 34,616 KB
最終ジャッジ日時 2023-09-13 00:11:34
合計ジャッジ時間 3,100 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 8 ms
6,964 KB
testcase_21 AC 9 ms
7,156 KB
testcase_22 AC 24 ms
15,624 KB
testcase_23 AC 59 ms
34,416 KB
testcase_24 AC 59 ms
34,616 KB
testcase_25 AC 8 ms
6,852 KB
testcase_26 AC 51 ms
30,228 KB
testcase_27 AC 17 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
ll dp[1000010][4];
int main(){
	int n;cin>>n;
	dp[0][0]=1;
	for(int i=0;i<=n;i++){
		for(int j=1;j<=3;j++){
			for(int k=0;k<=3;k++){
				if(j==k)continue;
				(dp[i+j][j]+=dp[i][k])%=MOD;
			}
		}
	}
	cout<<(dp[n][1]+dp[n][2]+dp[n][3])%MOD<<endl;
}
0