結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2019-07-13 09:21:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 77 ms / 1,000 ms |
コード長 | 634 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 64,380 KB |
実行使用メモリ | 57,780 KB |
最終ジャッジ日時 | 2024-11-21 13:04:32 |
合計ジャッジ時間 | 1,572 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;typedef long long ll;#define rep(i,n) for (int i = 0; i < (n); ++i)int main(){int N;cin >> N;vector<vector<ll>> ans(N,vector<ll>(3));// ans[i][0]:ケン1// ans[i][1]:ケン2// ans[i][2]:パans[0][0]=1;ans[0][1]=0;ans[0][2]=0;for(int i=1;i<N;i++){ans[i][0] = ans[i-1][2];ans[i][1] = ans[i-1][0];ans[i][2] = (ans[i-1][0] + ans[i-1][1]) % 1000000007;}ll ans_N = (ans[N-1][0] + ans[N-1][1] + ans[N-1][2]) % 1000000007;cout << ans_N << endl;return 0;}