题解 | #自守数#
自守数
http://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int n = scan.nextInt();
int count = 0;
for (int i = 0; i <= n; i++) {
int x = i * i;
if (x % 10 == i || x == i || x % 100 == i || x % 1000 == i || x % 10000 == i) {
count++;
}
}
System.out.println(count);
}
}
}