利用endswith完美解题
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int count=0;
for(int i=0;i<=a;i++){
if((i*i+"").endsWith(i+"")){//布吉岛为啥math.pow不能用
count++;
}
}
System.out.println(count);
}