結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-02-02 20:46:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 15 ms / 1,000 ms |
コード長 | 799 bytes |
コンパイル時間 | 2,302 ms |
コンパイル使用メモリ | 158,308 KB |
実行使用メモリ | 34,536 KB |
最終ジャッジ日時 | 2024-12-31 06:52:14 |
合計ジャッジ時間 | 2,593 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>#include "bits/stdc++.h"#include <iostream>#include <iomanip>#include <vector>#include <algorithm>#include <string>#include <sstream>#include <cmath>#include <stack>#include <queue>#include <cctype>#include <stdio.h>#include <map>#include <unordered_map>#include <string.h>#include <utility>typedef long long ll;#define rep(i,n) for(ll i=0;i<(ll)(n);i++)using namespace std;typedef pair<int, int> P;ll kenkenpa[1000001][4];int main() {int n;cin>>n;kenkenpa[1][1] =1;for(int i=2; i<=n; i++){kenkenpa[i][0] = (kenkenpa[i-1][1]+kenkenpa[i-1][2])%1000000007;kenkenpa[i][1] = kenkenpa[i-1][0]%1000000007;kenkenpa[i][2] = kenkenpa[i-1][1]%1000000007;}cout<<(kenkenpa[n][0]+kenkenpa[n][1]+kenkenpa[n][2])%1000000007<<endl;}