提交时间:2024-08-20 13:24:10
运行 ID: 168713
#include <iostream> #include<cstring> using namespace std; bool mi(int a) { int p1=1,p2=1; for (int i = 0;i <= a; ++i) { p1=2*p1; if(i==0) { p1=1; } for(int j =0;j<= a; ++j) { p2 =2*p2; if(j==0) { p2=1; } if (p1 + p2 == a) { return true; } } } return false; } int main() { int n, a; cin >> n; const int MAX_N = 100; char r[MAX_N][4]; for (int i = 0; i < n; ++i) { cin >> a; if (mi(a)) { strcpy(r[i], "Yes"); } else { strcpy(r[i], "No"); } } for (int i = 0; i < n; ++i) { cout << r[i] << "\n"; } return 0; }