提交时间:2024-08-19 14:40:04

运行 ID: 166482

#include <bits/stdc++.h> using namespace std; long long a[70]; int main() { a[0] = 1; for (int i = 1; i <= 62; i++) { a[i] = a[i - 1] * 2; } int t; cin >> t; while (t--) { long long n; cin >> n; bool flag = false; for (int i = 0; i <= 61; i++) { for (int j = 0; j <= 61; j++) { if (a[i] + a[j] == n) { flag = true; i = 61; } if (a[i] + a[j] > n) j = 61; } } if (flag || n == 0 || n == 1) cout << "yes" << endl; else cout << "no" << endl; } return 0; }