#include #include #include using namespace std; int count_fib(vector &v) { int max_v = 0; int a = 1; int b = 0; int ans = 0; vector fib_v; for(int i=0; i<100000; i++) { ans = a + b; fib_v.push_back(ans); a = b; b = ans; } vector count_v; int counter = 0; int n = 0; for(int i=0; i0; 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 v; int x; for(int i=0; i> x; v.push_back(x); } cout << count_fib(v); return 0; }