public class Main {
public static void main(String[] args) {
// 用一个数组存这0-9的数字,每个数字都有2021张
int[] arr = new int[] { 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021 };
int ans = 0;// 每一次拼好的数字
// 模拟拼数字
for (int i = 1;; i++) {
int k = i;
while (k != 0) {
//如果数组中这个数字用完了,就结束输出ans
if (arr[k % 10] == 0) {
System.out.println(ans);
return;
}
//没用完则让这个数字的张数-1
arr[k % 10]--;
k /= 10;
}
ans++;
}
}
}
0 回复
0 转发
0 喜欢
2 阅读



