蓝桥杯 填空 卡片

蓝桥杯 填空题 卡片


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

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;
}
相关推荐
·present·10 小时前
CSAPP(lecture 4_01)
c语言·c++
FPGA小迷弟10 小时前
用 Claude Code 重构遗留系统:从评估到落地的完整实践指南
c++·python·ai·plotly·django·ai编程·claude
程序员-King.10 小时前
【ROS1】Noetic 开发工作流程与常用命令
c++·ubuntu·ros
云深麋鹿10 小时前
C++ | 基于红黑树实现mymap与myset
开发语言·c++
傲世仙尊12 小时前
string增删查改-insert-erase-replace与find加substr组合技
c++
·present·13 小时前
CSAPP(lecture 3)
c++
别动我齐刘海14 小时前
机器人 C++ / 系统联调补强2——异常处理、Protobuf
linux·c++·人工智能·学习·算法·机器学习·机器人
basketball61614 小时前
C++ 中字符串与常见类型的转换总结
开发语言·c++
等我调个Bug14 小时前
C++智能指针通俗讲解
开发语言·c++
kyle~17 小时前
时间同步 --- PTP 与 Scheduled Action Command
c++·数码相机·机器人·传感器