import java.util.*;
public class specialmath {
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = 0, sum = 0;
for (int i = 1; i <= n; i++) {
String str = Integer.toString(i);
for (int j = 0; j <str.length(); j++) {
if (str.charAt(j) == '1' || str.charAt(j) == '2' || str.charAt(j) == '0' || str.charAt(j) == '9') {
x = 1;
break;
} else {
x = 0;
}
}
// ind == 1 说明 i 满足0,2,1,9特殊数。sum += i
if (x == 1) {
sum += i;
}
}
System.out.println(sum);
}
}
问:为什么单纯嵌套循环用取余再除不成功??