-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmart Number.java
More file actions
36 lines (32 loc) · 870 Bytes
/
Smart Number.java
File metadata and controls
36 lines (32 loc) · 870 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
/**
* @author: syed ashraf ullah
* date: 30/04/2020
* problem: https://www.hackerrank.com/challenges/smart-number/problem
*/
public class Solution {
public static boolean isSmartNumber(int num) {
int val = (int) Math.sqrt(num);
if(val * val == num)
return true;
return false;
}
public static void main(String[] args) {
int test_cases;
Scanner in = new Scanner(System.in);
test_cases = in.nextInt();
int num;
for(int i = 0; i < test_cases; i++){
num = in.nextInt();
boolean ans = isSmartNumber(num);
if(ans){
System.out.println("YES");
}
else System.out.println("NO");
}
}
}