fork download
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6.  
  7. #define ll long long
  8. const long long mod = 1e9+7;
  9.  
  10. using namespace std;
  11.  
  12. bool check(ll n) {
  13. if(n == 0 || n == 1) {
  14. return true;
  15. }
  16. ll fn1=1, fn2=0;
  17. for(int i=2; i<=92; i++) {
  18. ll fn = fn1 + fn2;
  19. if(fn == n) {
  20. return true;
  21. }
  22. fn2 = fn1;
  23. fn1 = fn;
  24. }
  25. return false;
  26. }
  27. int main(){
  28. int n; cin >> n;
  29. if(check(n)) {
  30. cout << "YES" << endl;
  31. }
  32. else {
  33. cout << "NO" << endl;
  34. }
  35. }
  36.  
Success #stdin #stdout 0s 5304KB
stdin
5
stdout
YES