SHARE
TWEET

Untitled

a guest Feb 15th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4. using namespace std;
  5. int main() {
  6.     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  7.     /*fstream cin("input.txt");
  8.     ofstream cout("output.txt");*/
  9.     vector<long long> v;
  10.     v.push_back(0);
  11.     v.push_back(1);
  12.     while (v.back() < 1e18) {
  13.         v.push_back(v[v.size() - 1] + v[v.size() - 2]);
  14.     }
  15.     long long n;
  16.     cin >> n;
  17.     for (int i = 0; i < v.size(); i++) {
  18.         if (v[i] == n) {
  19.             cout << i;
  20.             return 0;
  21.         }
  22.     }
  23.     cout << -1;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top