-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem9.java
More file actions
40 lines (32 loc) · 807 Bytes
/
Problem9.java
File metadata and controls
40 lines (32 loc) · 807 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
38
39
40
package dimikOJ;
import java.io.IOException;
import java.util.Scanner;
public class Problem9 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int T = input.nextInt();
while (T < 1 || T > 100) {
T = input.nextInt();
}
int[] inputs = new int[T];
for (int i = 0; i < inputs.length; i++) {
inputs[i] = input.nextInt();
while (inputs[i] < 0 || inputs[i] > Math.pow(2, 31)) {
inputs[i] = input.nextInt();
}
}
input.close();
for (int i : inputs) {
System.out.println(isSquare(i));
}
}
public static String isSquare(int n) {
int sqrt = (int) Math.sqrt(n);
if (sqrt * sqrt == n) {
return "Yes";
} else {
return "No";
}
}
}