Advertisement
newb_ie

without_bs

Sep 4th, 2021
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main () {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7. cout.tie(nullptr);
  8. map<long long,bool> m;
  9. for (long long i = 1; i <= 10000; ++i) {
  10. long long p = pow(i,3);
  11. m[p] = true;
  12. }
  13. int T;
  14. cin >> T;
  15. for (int test_case = 1; test_case <= T; ++test_case) {
  16. long long n;
  17. cin >> n;
  18. bool f = false;
  19. for (auto p : m) {
  20. long long x = p.first;
  21. long long y = n - x;
  22. if (m.find(y) != m.end()) {
  23. f = true;
  24. break;
  25. }
  26. }
  27. if (f) {
  28. cout << "YES\n";
  29. } else {
  30. cout << "NO\n";
  31. }
  32. }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement