結果

問題 No.533 Mysterious Stairs
ユーザー 777yuuki12323777yuuki12323
提出日時 2017-06-26 17:40:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 887 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 72,264 KB
実行使用メモリ 34,688 KB
最終ジャッジ日時 2024-04-15 01:54:11
合計ジャッジ時間 1,417 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 5 ms
6,912 KB
testcase_21 AC 6 ms
7,168 KB
testcase_22 AC 14 ms
15,616 KB
testcase_23 AC 35 ms
34,304 KB
testcase_24 AC 35 ms
34,688 KB
testcase_25 AC 6 ms
6,656 KB
testcase_26 AC 29 ms
30,208 KB
testcase_27 AC 11 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>


typedef long long ll;
#define fi first
#define se second
const ll mod = 1000000007;
//              123456789

using namespace std;

///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
ll cost[1234567][4];
ll ans = 0;


int main(){
	
	cin>>N;
	
	fill( cost[0], cost[N], 0 );
	
	cost[0][0] = 1;
	
	int i;
	int j;
	int k;
	
	for( i = 0; i <= N; i++ ){
		for( j = 0; j < 4; j++ ){
			for( k = 1; k < 4; k++ ){
				if( k != j ){
					(cost[i+k][k] += cost[i][j])%=mod;
				}
			}
		}
	}
	
	for( i = 1; i < 4; i++ ){
		(ans += cost[N][i])%=mod;
	}
	
	cout<<ans<<endl;
	
}
0