蓝桥杯 填空题 卡片

 解题思路: 我们只需要消耗完卡片的个数即可。
 代码示例:
#include<bits/stdc++.h>
using namespace std;
int a[10];
bool isEnd(){
	for(int i=0;i<10;i++){
		if(a[i]==-1)return false;
	}
	return true;
}
bool getN(int x){
	while(x){
		int t=x%10;
		a[t]--;
		if(!isEnd()){
			return false;
		}
		x/=10;
	}
	return true;
}
int main(){
	ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
	for(int i=0;i<10;i++)a[i]=2021;
	int i=1;
	for(;;i++){
		if(!getN(i)){
			cout<<i-1;return 0;//3181
		}
	}
	return 0;
}
                


















