门牌制作
思路:
- 暴力枚举
- 数位拆分
public class N592 {
static int[] counts = new int[10];
public static void main(String[] args) {
for (int i = 1; i <= 2020; i++) {
f(i);
}
System.out.println(counts[2]);
}
private static void f(int num) {
while (num != 0) {
counts[num % 10]++;
num /= 10;
}
}
}