結果
| 問題 | No.314 ケンケンパ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-31 12:08:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 703 bytes |
| コンパイル時間 | 649 ms |
| コンパイル使用メモリ | 62,136 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 02:22:41 |
| 合計ジャッジ時間 | 2,256 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 RE * 3 |
ソースコード
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdio>
#include <assert.h>
using namespace std;
typedef long long ll;
#define rep(i,b) for(ll i=0;i<(b);++i)
#define rep1(i,b) for(ll i=1;i<=(b);++i)
#define vec vector
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
int N;
#define MOD 1000000007
ll dp[100010][2];
int main() {
cin >> N;
dp[0][0] = 1;
dp[0][1] = 0;
dp[0][2] = 0;
rep(i, N) {
dp[i+1][1] = dp[i][0];
dp[i+1][2] = dp[i][1];
dp[i+1][0] = (dp[i][2] + dp[i][1]) % MOD;
}
cout << ((dp[N][0] + dp[N][1] + dp[N][2]) % MOD) << endl;
}