当前位置:网站首页>Maximum number of "balloons"
Maximum number of "balloons"
2022-07-05 05:27:00 【low dog】
Their thinking
First, we will count the variables of each letter , Let me create a variable for the final output ( That is, and all the minimum values , That is to say Number of whole words ), Then scan the input , adopt switch The function counts each letter on a line , Finally, after processing the counted variables , Compare the rows and assign the minimum value to the variable to be returned .
All the code
int nums(char* text){
int b,a,l,o,n;
int min=0;
while(*text){
switch(*text){
case 'b':b++;break;
case 'a':a++;break;
case 'l':l++;break;
case 'o':o++;break;
case 'n':n++;break;
}
*text++;
}
l/=2;
o/=2;
min=b<a?b:a;
min=min<l?min:l;
min=min<o?min:o;
min=min<n?min:n;
return min;
}边栏推荐
- xftp7与xshell7下载(官网)
- Remote upgrade afraid of cutting beard? Explain FOTA safety upgrade in detail
- Service fusing hystrix
- A new micro ORM open source framework
- Gbase database helps the development of digital finance in the Bay Area
- Csp-j-2020-excellent split multiple solutions
- YOLOv5添加注意力机制
- 小程序直播+電商,想做新零售電商就用它吧!
- Es module and commonjs learning notes
- Using HashMap to realize simple cache
猜你喜欢
![[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research](/img/17/db8614b177f33ee4f67b7d65a8430f.png)
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research

第六章 数据流建模—课后习题

C语言杂谈1

Research on the value of background repeat of background tiling

lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8

用STM32点个灯

2022年上半年国家教师资格证考试

GBase数据库助力湾区数字金融发展

Fragment addition failed error lookup

利用HashMap实现简单缓存
随机推荐
26、 File system API (device sharing between applications; directory and file API)
[binary search] 34 Find the first and last positions of elements in a sorted array
[to be continued] [depth first search] 547 Number of provinces
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
[allocation problem] 135 Distribute candy
Haut OJ 1321: mode problem of choice sister
读者写者模型
Bubble sort summary
[interval problem] 435 Non overlapping interval
Introduction to memory layout of FVP and Juno platforms
National teacher qualification examination in the first half of 2022
剑指 Offer 05. 替换空格
[allocation problem] 455 Distribute cookies
Zheng Qing 21 ACM is fun. (3) part of the problem solution and summary
JVM call not used once in ten years
Solon Auth 认证框架使用演示(更简单的认证框架)
Use of snippets in vscode (code template)
The next key of win generates the timestamp file of the current day
Learning notes of "hands on learning in depth"
Shell Sort