1475A. Odd Divisor
math, number theory, 900, https://codeforces.com/problemset/problem/1475/A
You are given an integer 𝑛. Check if 𝑛 has an odd divisor, greater than one (does there exist such a number 𝑥 (𝑥>1) that 𝑛 is divisible by 𝑥 and 𝑥 is odd).
For example, if 𝑛=6, then there is 𝑥=3. If 𝑛=4, then such a number does not exist.
Input
The first line contains one integer
Each test case contains one integer
Please note, that the input for some test cases won't fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language.
Output
For each test case, output on a separate line:
- "YES" if 𝑛n 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
1099511627776Output
NO
YES
NO
YES
YES
NOt = int(input())
for _ in range(t):
n = int(input())
# 不断除以 2 直到 n 是奇数
while n % 2 == 0:
n //= 2
# 检查 n 是否大于 1
if n > 1:
print("YES")
else:
print("NO")