Monday 23 January 2017

Finding Power of 2

Mufaddal is organizing the table tennis tournament for Athlos. He calls a tournament to be "Perfect" if the number of participants in the tournament is a power of two.

Given the number of participants N you need to help Mufaddal determine if the tournament will be "Perfect" or not.
Input Format
The first line of input contains T denoting the number of testcases (Number of tournaments). It is followed by T lines containing one integer per line which denotes the total number of participants in that tournament.
Constraints
1 ≤ T ≤ 106
1 ≤ N ≤ 2 * 1018
Output Format
Print T lines (one for each testcase), if the tournament is perfect print "Yes" (without quotes) otherwise print "No" (without quotes).
Sample Input 0
4
8
5
4
11
Sample Output 0
Yes
No
Yes
No

No comments:

Post a Comment