当前位置:网站首页>True title of Blue Bridge Cup: Card [easy to understand]
True title of Blue Bridge Cup: Card [easy to understand]
2022-07-23 17:27:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Title Description
This question is to fill in the blanks , Just calculate the result , Use the output statement in the code to output the filled results .
Xiaolan has a lot of digital cards , There are numbers on every card 0 To 9. Xiao Lan is going to use these cards to spell some numbers , He wants to start with 1 Start spelling positive integers , Each one , Just keep it , Cards can't be used to spell other numbers . Xiao Lan wants to know that she can learn from 1 How much do you spell . for example , When little blue has 30 Cards , among 0 To 9 various 3 Zhang , Then Xiaolan can spell 11 To 1010, But it's hard to 11 Time cards 1 There's only one left , It's not enough to spell 11. Now Xiaolan has 0 To 9 All the cards are 2021 Zhang , common 20210 Zhang , May I ask Xiao Lan how to get it from 1 How much do you spell ? Tips : Computer programming is recommended to solve the problem
Operation limit
- Maximum operation time :1s
- Maximum running memory : 128M
The violence is over , Pure simulation , But note that the boundary condition is -1 instead of 0:
#include <bits/stdc++.h>
using namespace std;
vector<int> num(2020,2021);
bool check(int n)
{
while(n)
{
num[n%10]--;
if(num[n%10]==-1) return false;
n/=10;
}
return true;
}
int main()
{
// Please enter your code here
int ans=1;
while(check(ans))
{
ans++;
}
cout<<ans-1;
// cout<<3181;
return 0;
}The answer is 3181
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/126489.html Link to the original text :https://javaforall.cn
边栏推荐
- 59. General knowledge of lightning safety
- IR Drop 、EM、Noise 和Antenna
- 【mysql集群故障恢复】
- 从马尔可夫链到GPT,字节跳动AI Lab总监李航细说语言模型的前世今生
- 蓝桥杯真题:卡片[通俗易懂]
- Leetcode question brushing record
- Add dependent jar packages to the project in the idea
- Food safety eating preserved eggs will lead poisoning? Don't worry about eating after knowing these points
- Food safety | eight things you must know when choosing probiotic products
- Description and usage of Axi interconnect IP core
猜你喜欢

Food safety chocolate is also true or false? How much do you know about it

Explication détaillée de l'injection aveugle d'erreur SQL

程序环境和预处理

Pymoo learning (3): use multi-objective optimization to find the set of optimal solutions

Pyinstaller+InstallForge多文件项目软件打包

Sorting - introduction, code ideas, usage suggestions, code implementation -1

场景小小记

可视化机房管理

Major upgrade of openim - group chat reading diffusion model release group management function upgrade

IR Drop 、EM、Noise 和Antenna
随机推荐
合宙ESP32C3基于VSCode PIO Arduino开发框架初探教程
Repository XXX does not have a Realease file「建议收藏」
July training (day 23) - dictionary tree
深拷贝deepClone的实现
Vscode - code and file changes cannot be saved
Thread pool, who am I? Where am I?
IR Drop 、EM、Noise 和Antenna
数组和特殊矩阵的压缩存储
【mysql集群故障恢复】
gom及gee架设黑屏的原因以及个别装备地图不显示怎么办?
Summary of stock historical data download interface (dynamic update)
爱可可AI前沿推介(7.23)
First deep search and first wide search of graph (realized by three methods)
Search Binary Tree - find nodes, insert nodes, delete nodes
Food safety | eight things you must know when choosing probiotic products
Shrimp noodles: what do you know about the JVM memory layout?
[introduction series of redis] data types and related commands of redis
Typescript 清空数组
C语言·结构体(线性表入门)
Kubernetes kubelet hard core knowledge architecture