简单粗暴,还以为要整大数呢
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int n = scanner.nextInt();
int selfHoldNumber = 0;
for (int i = 0; i <= n; i++) {
if (((int) Math.pow(i, 2) + "").endsWith(i+"")) {
selfHoldNumber++;
}
}
System.out.println(selfHoldNumber);
}
}
}