|
|
back to boardif you are not a f*****g mathematician may be hard on time, but as clear as possible #include <iostream> #include <set> #include <cmath> #include <string> using namespace std; int main() { long long k = 0; set<long long> v; v.insert(0); for (long long i = 0; i < 2147483648;){ i = *prev(v.end()) + (++k); v.insert(i); } long long number; cin >> number; long long n; string word; for (size_t i = 0; i < number; i++) { cin >> n; if (v.find(n-1) != v.end()) word += '1'; else word += '0'; word += ' '; } cout << word << endl; return 0; } |
|
|