题目
代码
#includeusing namespace std;int main(){ int num[10]; for (int i = 0; i < 10; i++) num[i] = 2021; int ans = 1; int flag = 0; while (1) { int tmp = ans; while (tmp) { if (num[tmp % 10] > 0) num[tmp % 10]--; else { flag = 1; break; } tmp /= 10; } if (flag == 1) { ans--; break; } else ans++; } printf("%d", ans); return 0;}
答案
3181