Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std ;
- #define sz(s) int(s.size())
- #define all(v) v.begin() , v.end()
- #define imin INT_MIN
- #define imax INT_MAX
- typedef long long ll ;
- #define Time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << "\n";
- #define all(s) s.begin(), s.end()
- #define cin(v) for (auto& i : v) cin >> i ;
- #define pb(x) push_back(x)
- #define getline(s) getline(cin >> ws, s)
- void ABDEL3AL () {
- ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
- #ifndef ONLINE_JUDGEt
- freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
- #endif
- Time
- }
- bool is_palindroom (string s) {
- int l = 0 , r = sz(s) - 1 ;
- while (l <= r) {
- if (s[l++] != s[r--]) return false ;
- }
- return true ;
- }
- string bin_to_dec (int n) {
- string bin ;
- while (n) {
- bin += (n % 2 + '0') ;
- n /= 2 ;
- }
- reverse(all(bin)) ;
- return bin ;
- }
- int main() {
- ABDEL3AL() ;
- ll n ; cin >> n , cout << (is_palindroom(bin_to_dec(n)) && n % 2 ? "YES" : "NO") ;
- return 0;
- }
Add Comment
Please, Sign In to add comment