提交时间:2024-08-19 22:23:04

运行 ID: 168085

#include <bits/stdc++.h> using namespace std; bool check(int n, const unordered_set<int>& a) { for (int p : a) { if (a.count(n - p)) { return true; } } return false; } int main() { unordered_set<int> a; for (int i = 0; i <= 30; ++i) { a.insert(1 << i); } int t; cin >> t; while (t--) { int n; cin >> n; if (check(n, a)) { cout << "yes" << endl; } else { cout << "no" << endl; } } return 0; }