sdnu1483.Problem_A(位运算+大数)
Description
Check whether an integer n is a power of 2.
Input
First line contains a single integer T (T<=20000000) which denotes the number of test cases. For each test case, there is an big integer N(0 < N < 2^1000)
Output
For each case, output the "Yes" or "No" in a single line.
Sample Input
3
1
3
8
Sample Output
Yes
No
Yes
位运算判断是否是2的整数次幂(x-1)& x == 0 是 else不是
ps:是否是4的整数次幂:if((x&0x55555555)==x) 是 else 不是
python真强 !
t = int(input())
while t > 0:
a = int(input())
if (a - 1) & a == 0:
print("Yes")
else:
print("No")
t = t - 1