結果

問題 No.314 ケンケンパ
ユーザー PicklesSuperior
提出日時 2019-02-20 14:14:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 55,932 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 19:44:03
合計ジャッジ時間 1,211 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
k1
k2 p
p k1
k1 k2 p
k2 p p k1
p k1 k1 k2 p
k1 k2 p k2 p p k1
*/
#include<iostream>
using namespace std;
long int k_one=1,k_two=0,p=0,N;

void step(){
    long int tmp_k_one,tmp_k_two,tmp_p;

    tmp_k_one=k_one;
    tmp_k_two=k_two;
    tmp_p=p;

    k_one=tmp_p;
    k_two=tmp_k_one;
    p=tmp_k_one+tmp_k_two;
}

int main(){
    cin >> N;
    long int count=1,ans,mod=1e9+7;

    while(count<N){
        step();
        count++;
    }
    cout<<"k1:"<<k_one<<" k2:"<<k_two<<" p:"<<p<<endl;
    ans=(k_one+k_two+p)%(mod);
    cout << ans << endl;

    return 0;
}
0