-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10448.cpp
49 lines (45 loc) · 986 Bytes
/
10448.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int main() {
cin.tie(0);
std::ios_base::sync_with_stdio(0);
vector<int> v;
int i = 1;
while(true){
if(i*(i+1)/2 <= 1000){
v.push_back(i*(i+1)/2);
i++;
}else{
break;
}
}
int n;
cin >> n;
while(n--){
int a;
cin >> a;
bool f = false;
for(int i = 0; i<v.size(); i++){
for(int j = 0; j<v.size(); j++){
for(int k = 0; k<v.size(); k++){
if(v[i] + v[j] + v[k] == a){
cout << 1 << "\n";
f = true;
break;
}
}
if(f){
break;
}
}
if(f){
break;
}
}
if(f == false){
cout << 0 << "\n";
}
}
}