蓝桥杯 填空 卡片

蓝桥杯 填空题 卡片


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

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;
}
相关推荐
JMchen几秒前
性能优化——让Native代码飞起来
android·c++·性能优化
chenbingjie_c18 分钟前
手撕 C++ priority_queue:二叉堆 + 模板仿函数 + 模板特化(保姆级逐函数拆解)
开发语言·c++
小小龙学IT39 分钟前
C++ Redis 客户端深度解析(hiredis 与 redis-plus-plus)——工业数采实时缓存 C++ 侧实战
c++·redis·缓存
垆边人似月.1 小时前
华为机试题 :最长递增子序列题目
数据结构·c++·算法·华为
开发者联盟league1 小时前
c++11 使用chrono库转换时间点和字符串,计算时间点间隔
java·c++·算法
蜕变的土豆2 小时前
工业监控RTSP取流-实践指南
c++·视频
进化中的刀盾兽2 小时前
从零实现 C++ Json-Rpc(八):补齐 detail.hpp——JSON 封装与请求 ID 生成
c++·rpc
longlongzihan2 小时前
LeetCode 41. 缺失的第一个正数:从基础解法到原地哈希
c++·算法·leetcode
Lhan.zzZ3 小时前
Qt/QML:业务记录单展示、签名确认与 PDF 导出开发
c++·qt·pdf
傲世仙尊3 小时前
类和对象上-class与struct实例化内存对齐与this指针
c++