自守数(JAVA)暴力
自守数
http://www.nowcoder.com/questionTerminal/88ddd31618f04514ae3a689e83f3ab8e
注意下1就好
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); while (in.hasNext()){ int n = in.nextInt(); int res = 0; for (int i = 0; i < n; i++){ int k = 1; while(k < i) k*= 10; int b = i * i / k; int c = i * i - b * k; if (c == i){ res++; } } System.out.println(res+1); } } }