-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1490C.cpp
More file actions
37 lines (29 loc) · 696 Bytes
/
1490C.cpp
File metadata and controls
37 lines (29 loc) · 696 Bytes
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
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool is_cube(ll n) {
ll root = cbrt(n);
return root * root * root == n || (root+1)*(root+1)*(root+1) == n;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
ll x;
cin >> x;
bool found = false;
for (ll a = 1; a * a * a < x; ++a) {
ll a_cubed = a * a * a;
ll b_cubed = x - a_cubed;
if (b_cubed <= 0) continue;
if (is_cube(b_cubed)) {
found = true;
break;
}
}
cout << (found ? "YES\n" : "NO\n");
}
return 0;
}