Advertisement
Ritam_C

Codeforces Odd Divisor

Jan 25th, 2021
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1.     #include <bits/stdc++.h>
  2.     using namespace std;
  3.      
  4.     int ln2(int64_t n){
  5.         while(n > 1){
  6.             if(n%2 == 0){
  7.                 n /= 2;
  8.             } else{
  9.                 return -1;
  10.             }
  11.         }
  12.         return 1;
  13.     }
  14.      
  15.     int main(){
  16.         ios_base::sync_with_stdio(false);
  17.         cin.tie(NULL);
  18.         int t;
  19.         cin >> t;
  20.         while(t--){
  21.             int64_t n;
  22.             cin >> n;
  23.             if(ln2(n) == 1){
  24.                 cout << "NO\n";
  25.             } else{
  26.                 cout << "YES\n";
  27.             }
  28.         }
  29.         return 0;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement