結果

問題 No.314 ケンケンパ
ユーザー kenken714kenken714
提出日時 2019-02-07 23:20:18
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,022 bytes
コンパイル時間 2,187 ms
コンパイル使用メモリ 71,352 KB
実行使用メモリ 6,736 KB
最終ジャッジ日時 2023-09-08 13:51:12
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll dp[110000][2][2],ans = 0;
int main() {
	dp[0][1][1] = 1;
	ll n; cin >> n;
	REP(i, n) {
		REP(j, 2) {
			REP(k, 2) {
				if (j == 1 or k == 1) {
					dp[i + 1][k][0] += dp[i][j][k];
					dp[i + 1][k][0] %= MOD;
				}
				if (k == 0) {
					dp[i + 1][0][1] += dp[i][j][0];
					dp[i + 1][0][1] %= MOD;
				}
			}
		}
	}
	REP(i, 2) {
		REP(j, 2) {
			ans += dp[n][i][j];
			ans %= MOD;
		}
	}
	cout << ans << endl;
}
0