Task: | Neliöt |
Sender: | hltk |
Submission time: | 2020-11-06 18:09:25 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 28 |
#2 | ACCEPTED | 72 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 1, 2 | details |
#3 | ACCEPTED | 0.02 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&tc); ~~~~~^~~~~~~~~~ input/code.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ~~~~~^~~~~~~~~
Code
#include<bits/stdc++.h> #define sz(x) ((int)(x).size()) #define all(x) x.begin(),x.end() using namespace std; using pi = pair<int,int>; using lint = long long; bool sq(int x){ int u = (int)sqrt(x); return u * u == x; } int main(){ int tc; scanf("%d",&tc); while(tc--){ int n; scanf("%d",&n); bool ok = false; for(int a = 1; a*a<=n; ++a){ if(sq(n-a*a)){ ok = true; } } puts(ok ? "YES" : "NO"); } }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
input |
---|
100 1 2 3 4 ... |
correct output |
---|
YES YES NO YES YES ... |
user output |
---|
YES YES NO YES YES ... Truncated |
Test 2
Group: 1, 2
Verdict: ACCEPTED
input |
---|
100 522 419 402 969 ... |
correct output |
---|
YES NO NO NO NO ... |
user output |
---|
YES NO NO NO NO ... Truncated |
Test 3
Group: 2
Verdict: ACCEPTED
input |
---|
100 575833539 744851460 436154655 655319365 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO NO ... Truncated |