蓝桥杯 填空 卡片

蓝桥杯 填空题 卡片


解题思路: 我们只需要消耗完卡片的个数即可。
代码示例:

c 复制代码
#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;
}
相关推荐
码匠许师傅18 小时前
【设计模式精讲】14.外观模式(Facade)
c++·设计模式·uml·外观模式
xxwxx__20 小时前
C++ list 深度解析:从使用原理到模拟实现
开发语言·c++·list
Chester_199920 小时前
CSP202303C.LDAP
开发语言·c++·蓝桥杯·stl
j7~21 小时前
【C++】《unordered系列关联式容器以及哈希底层、哈希冲突、闭散列与开散列完整解析》
c++·哈希算法·开散列·闭散列·unordered_map·unordered_set·哈希底层结构
2402_882893861 天前
封装红黑树实现map和set —— 从源码到模拟实现
c++·set·map
神仙别闹1 天前
基于C++ MFC 实现的智慧公交系统
开发语言·c++·mfc
dear_bi_MyOnly1 天前
函数模块化:企业级项目高效之道
c++·后端·学习
码匠许师傅1 天前
【设计模式精讲】13.装饰器模式(Decorator)
c++·设计模式·uml·装饰器模式
OPEN-F1 天前
C++综合实战:面向对象图书管理系统
开发语言·c++
NeoGressAI外贸数字化1 天前
外贸独立站零询盘排查:从 Google Search Console 到 PageSpeed 的技术实操
开发语言·c++