A. Odd Divisor
You are given an integer nn. Check if nn has an odd divisor, greater than one (does there exist such a number xx (x>1x>1) that nn is divisible by xx and xx is odd).
For example, if n=6n=6, then there is x=3x=3. If n=4n=4, then such a number does not exist.Input
The first line contains one integer tt (1≤t≤1041≤t≤104) — the number of test cases. Then tt test cases follow.
Each test case contains one integer nn (2≤n≤10142≤n≤1014).
Please note, that the input for some test cases won’t fit into 3232-bit integer type, so you should use at least 6464-bit integer type in your programming language.Output
For each test case, output on a separate line:
- “YES” if nn has an odd divisor, greater than one;
- “NO” otherwise.
You can output “YES” and “NO” in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).
Example
input
6
2
3
4
5
998244353
1099511627776
output
NO
YES
NO
YES
YES
NO
我的题解
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
long long a;
cin>>a;
while(a%2==0)
{
a/=2;
}
if(a!=1) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}