Advertisement
srtgguy

Untitled

Jun 4th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int function(int n)
  6. {
  7.     if (n == 1)
  8.     {
  9.         return 1;
  10.     }
  11.     if (n % 2 == 0)
  12.         return function(n / 2);
  13.     if (n % 2 != 0)
  14.         return 3;
  15. }
  16.  
  17. int main()
  18. {
  19.     int n;
  20.     cin >> n;
  21.     if (function(n) == 1)
  22.         cout << "YES" << endl;
  23.     else
  24.         cout << "NO" << endl;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement