Advertisement
Guest User

Untitled

a guest
Feb 15th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement