fork download
  1. #include<iostream>
  2. #include<algorithm>
  3. using namespace std;
  4. int fr[100006];
  5. string sum(long long n);
  6. void check(string x);
  7. #include<stack>
  8. #include<queue>
  9. int main()
  10. {
  11. long long x;
  12. cin >> x;
  13. if (x % 2 == 0)
  14. {
  15. cout << "NO\n";
  16. return 0;
  17. }
  18. string y = sum(x);
  19. check(y);
  20. return 0;
  21. }
  22. string sum(long long n)
  23. {
  24. string m = "";
  25. while (n != 0)
  26. {
  27. m += n % 2;
  28. n /= 2;
  29. }
  30. return m;
  31. }
  32. void check(string x) {
  33. string z = x;
  34. reverse(x.begin(), x.end());
  35. if (z == x)
  36. cout << "YES\n";
  37. else
  38. cout << "NO\n";
  39. }
  40. bool is_odd(int n)
  41. {
  42. return (n % 2 != 0);
  43. }
Success #stdin #stdout 0.01s 5348KB
stdin
Standard input is empty
stdout
NO