CF 1475A - Odd Divisor
You are given an integer n. Check if n has an odd divisor, greater than one (does there exist such a number x (x>1) that n is divisible by x
and x is odd).
For example, if n=6, then there is x=3. If n=4, then such a number does not exist.
Input
The first line contains one integer t (1≤t≤104) — the number of test cases. Then t test cases follow.
Each test case contains one integer n (2≤n≤1014).
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).
---------------------------------------
给定一个整数 n。 检查 n 是否有一个大于 1 的奇数约数(是否存在这样的数字 x (x>1) 使得 n 可以被 x 整除
x 是奇数)。
例如,如果n=6,则x=3。 如果n=4,那么这样的数不存在。
输入
第一行包含一个整数 t (1≤t≤104) — 测试用例的数量。 然后是测试用例。
每个测试用例包含一个整数n(2≤n≤1014)。
请注意,某些测试用例的输入不适合 32 位整数类型,因此您应该在编程语言中至少使用 64 位整数类型。
输出
对于每个测试用例,在单独的行上输出:如果 n 具有大于 1 的奇数除数,则输出“YES”;否则输出“NO”。
您可以在任何情况下输出“YES”和“NO”(例如,字符串 yEs、yes、Yes 和 YES 将被识别为正数)。
----------------------------------------------
如果这个数是奇数,那么它肯定是yes的,如果这个数是偶数,那么就要一直除以2,去看最后的商是否大于1,如果大于1,那么是yes的,如果等于1,那就是NO的;
下面待代码: