蓝桥杯 填空 卡片

蓝桥杯 填空题 卡片


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

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;
}
相关推荐
蒸蒸yyyyzwd5 小时前
秋招学习笔记 day46
c++·八股
码匠许师傅8 小时前
【C++三方组件】cpp-httplib:一个头文件起 HTTP 服务
开发语言·c++·http
无名猿9 小时前
new/delete 与 malloc/free:为什么绝对不能混用
c++·内存管理·现代c++·踩坑记录
2601_9622186111 小时前
C++中decltype关键字的实现
开发语言·c++
繁华的地方不一定留下你的脚印11 小时前
C++ std::variant 与 std::visit:安全保存多种类型,写清每个处理分支
开发语言·c++
程序员老陆12 小时前
WIN32_LEAN_AND_MEAN:Windows 头文件里的“精简编译开关”
c++·windows
hold?fish:palm13 小时前
45 二叉树的右视图
开发语言·c++·算法
ShineWinsu13 小时前
对于Redis:Redis的认识以及分布式系统的解析
linux·数据库·c++·redis·缓存·消息队列·分布式架构
布莱克60513 小时前
在C++中,构造函数能不能是虚函数?析构函数为什么要虚?
开发语言·c++·构造函数·析构函数·虚函数
旖旎夜光14 小时前
LeetCode 137 : 只出现一次的数字 II(位运算) —— 题解
c++·笔记·学习·算法·leetcode·力控