可以发现:n为奇数时其自身就已经符合条件,n为偶数的时候,对n不断/2,若能得到大于1的奇数则满足。
#include<iostream>
#define endl '\n'
using namespace std;
void solve(long long x) {
if (x & 1) {
cout << "YES" << endl;
return;
}
while (x>2) {
if ((x / 2) & 1) {
cout << "YES" << endl;
return;
}
x /= 2;
}
cout << "NO" << endl;
}
int main() {
int t;
long long n;
cin >> t;
while (t--) {
cin >> n;
solve(n);
}
return 0;
}