| Task: | Neliöt |
| Sender: | TapaniS |
| Submission time: | 2020-11-07 08:41:09 +0200 |
| Language: | Java |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.15 s | 1, 2 | details |
| #2 | WRONG ANSWER | 0.15 s | 1, 2 | details |
| #3 | WRONG ANSWER | 0.16 s | 2 | details |
Code
import java.util.*;
public class neliot {
public static int find(int[] a, int target)
{
for (int i = 0; i < a.length; i++)
if (a[i] == target)
return i;
return -1;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
String[] ans = new String[t];
int a = 0;
int b = 0;
for (int t1 = 0; t1 < t; t1++) {
int n = input.nextInt();
ans[t1] = "NO";
if (n < 3) {
ans[t1] = "YES";
continue;
}
// n >= 3
int maxVal1 = (int) Math.sqrt(n/2);
int maxVal2 = (int) Math.sqrt(n);
a = 0;
b = 0;
for (int i = maxVal2; i >= maxVal1; i--) {
b = i * i;
a = (int) Math.sqrt(n-b);
if ((a + b) == n) {
ans[t1] = "YES";
break;
}
}
} // t1
for (int i = 0; i < t; i++) {
System.out.println(ans[i]);
}
input.close();
}
}Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
| 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: WRONG ANSWER
| input |
|---|
| 100 522 419 402 969 ... |
| correct output |
|---|
| YES NO NO NO NO ... |
| user output |
|---|
| NO NO NO NO NO ... Truncated |
Test 3
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 100 575833539 744851460 436154655 655319365 ... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| NO NO NO NO NO ... Truncated |
