結果

問題 No.314 ケンケンパ
ユーザー PicklesSuperiorPicklesSuperior
提出日時 2019-02-20 14:14:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 54,680 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-24 11:55:57
合計ジャッジ時間 1,122 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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