結果

問題 No.314 ケンケンパ
ユーザー KoshStormKoshStorm
提出日時 2017-12-18 01:15:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 942 bytes
コンパイル時間 1,705 ms
コンパイル使用メモリ 170,256 KB
実行使用メモリ 57,856 KB
最終ジャッジ日時 2024-05-09 11:10:28
合計ジャッジ時間 2,654 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define dump1d_arr(array,i) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array,i,j) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define loINF (long)10000000000
#define shINF (short)10000

const long mod = 1e9 + 7;

using namespace std;
typedef vector<long> VL;
typedef vector<VL> VVL;

int main(void){
	long N;
	cin >> N;

	VVL dp(N+1, VL(3,0));
	dp[1][1] = 1;

	FOR(i,2,N+1){
		REP(j,3){
			if (j == 0) dp[i][j] = dp[i-1][1] + dp[i-1][2];
			else { dp[i][j] = dp[i-1][j-1];}
		}
	}

	cout << ((dp[N][0] + dp[N][1] + dp[N][2]) % mod) << endl;




	return 0;
}
0