結果
| 問題 | No.314 ケンケンパ |
| コンテスト | |
| ユーザー |
sei0o
|
| 提出日時 | 2017-10-16 17:27:10 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 632 bytes |
| 記録 | |
| コンパイル時間 | 376 ms |
| コンパイル使用メモリ | 97,224 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-09-25 13:24:05 |
| 合計ジャッジ時間 | 2,734 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 RE * 3 |
ソースコード
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
ll dp[100010][3];
int main() {
int N;
cin >> N;
dp[0][0] = 1;
for (int i = 0; i < N; i++) {
dp[i+1][0] = dp[i][1] + dp[i][2]; // パー
dp[i+1][1] = dp[i][0]; // ケン
dp[i+1][2] = dp[i][1]; // ケン2回目
dp[i+1][0] %= MOD;
dp[i+1][1] %= MOD;
dp[i+1][2] %= MOD;
}
cout << (dp[N][0] + dp[N][1] + dp[N][2]) % MOD << endl;
return 0;
}
sei0o