結果

問題 No.954 Result
ユーザー yolishyolish
提出日時 2020-01-23 22:03:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,060 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 71,188 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 12:42:16
合計ジャッジ時間 2,319 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 3 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 3 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
4,376 KB
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;

int count_fib(vector<int> &v) {
    int max_v = 0;



    int a = 1;
    int b = 0;
    int ans = 0;
    vector<int> fib_v;

    for(int i=0; i<100000; i++) {
        ans = a + b;
        fib_v.push_back(ans);
        a = b;
        b = ans;
    }

    vector<int> count_v;
    int counter = 0;
    int n = 0;
    for(int i=0; i<v.size(); i++) {
        for(int j=fib_v.size(); j>0; j--) {
            if(v[i] == fib_v[j]) {
                n = i;
                for(int k=j; k>0; k--) {
                    if(v[n] == fib_v[k]) {
                        n--;
                    } else if(n!=0){
                        continue;
                    } else {
                        goto exit;
                    }
                }
            }
        }
    }


    exit:

    return counter;
}

int main() {

    int N = 5;
    vector<int> v;
    int x;
    for(int i=0; i<N; i++) {
        cin >> x;
        v.push_back(x);
    }

    cout << count_fib(v);

    return 0;
}
0