提交时间:2024-08-19 19:40:49
运行 ID: 167855
#include<iostream> using namespace std; /*const int a[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,...};*/ int binpow(int a,int b){ int res = 1; while(b > 0){ if(b & 1){ res *= a; } a *= a; b >>= 1; } return res; } bool check(int n){ for(int i = 0; i <= 30; i++){ for(int j = 0; j <= 30; j++){ if(binpow(2,i)+binpow(2,j) == n){ return true; } } } return false; } int main(){ int T,n; for(cin>>T; cin>>n; cout<<(check(n) ? "yes" : "no")<<'\n'); return 0; }