Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
166298 | qiuyanshen | 二进制半整数 | C++ | 解答错误 | 40 | 4 MS | 268 KB | 730 | 2024-08-19 10:59:39 |
#include<bits/stdc++.h> using namespace std; bool f(long long n){ return (!(n&(n-1)))&&n; } int main(){ int t,a; long long n,c; cin>>t; while(t--){ cin>>n; if(n%2==1||n==0){ cout<<"no"<<endl; continue; } if(f(n)==1){ if(n!=2){ cout<<"yes"<<endl; } else{ cout<<"no"<<endl; } continue; } long long m=n; a=0; while(m>1){ m=m>>1; a++; } if(f(n-(long long)pow(2,a))==1) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0; }