题解 | #矩阵乘法计算量估算#
自守数
http://www.nowcoder.com/practice/88ddd31618f04514ae3a689e83f3ab8e
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextLine()) {
int num = Integer.parseInt(in.nextLine());
System.out.println(getNum(num));
}
}
public static int getNum(int a){
int count = 0;
for(int i=0;i<= a;i++){
int length = String.valueOf(i).length();
if(Math.pow(i,2) % Math.pow(10,length) == i){
count++;
}
}
return count;
}
}
