import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s=new Scanner(System.in);
StringBuffer sb = new StringBuffer("");
while (true) {
long x = s.nextLong();
if (x == 0) {
break;
}
if (is_Psquare(x)) {
sb.append("yes\n");
} else {
sb.append("no\n");
}
}
System.out.print(sb);
}
static boolean is_Psquare(long x) {
long root = (long) (Math.floor(Math.sqrt(x) + 0.5));
return root * root == x;
}
}
public class Main {
public static void main(String[] args){
Scanner s=new Scanner(System.in);
StringBuffer sb = new StringBuffer("");
while (true) {
long x = s.nextLong();
if (x == 0) {
break;
}
if (is_Psquare(x)) {
sb.append("yes\n");
} else {
sb.append("no\n");
}
}
System.out.print(sb);
}
static boolean is_Psquare(long x) {
long root = (long) (Math.floor(Math.sqrt(x) + 0.5));
return root * root == x;
}
}
I think doesn`t work!
ReplyDeleteI have checked it .... and I got accepted again .. You can check also my C solution for the same problem ...
Delete