5 solutions

  • 1
    @ 2022-4-2 21:27:10
    #include<stdio.h>
    int main(){
    	long long num;//要判断的数 
    	int m;
    	int count;
    	scanf("%d",&m);
    	for(int i=0; i<m; i++){//m行数 
    		scanf("%lld",&num);
    		//是2的幂次方只有两个条件,1:大于0  2:二进制只有一个1,因此一旦减1比为0 
    			if((num&(num-1))== 0 && num>0)
    			  printf("YES\n");
    			else
    			  printf("NO\n");
    	}
    }
    

    Information

    ID
    47
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    1456
    Accepted
    228
    Uploaded By