当前位置:网站首页>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;
}
边栏推荐
- [turn]: Apache Felix framework configuration properties
- JVM call not used once in ten years
- Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
- 26、 File system API (device sharing between applications; directory and file API)
- Haut OJ 1401: praise energy
- Software test -- 0 sequence
- Yolov5 ajouter un mécanisme d'attention
- Bubble sort summary
- National teacher qualification examination in the first half of 2022
- 注解与反射
猜你喜欢
剑指 Offer 53 - I. 在排序数组中查找数字 I
Talking about JVM (frequent interview)
Shell Sort
[to be continued] [UE4 notes] L2 interface introduction
Gbase database helps the development of digital finance in the Bay Area
Use of snippets in vscode (code template)
TF-A中的工具介绍
The present is a gift from heaven -- a film review of the journey of the soul
Web APIs DOM节点
Generate filled text and pictures
随机推荐
Haut OJ 2021 freshmen week II reflection summary
Binary search basis
【ES实战】ES上的native realm安全方式使用
Generate filled text and pictures
挂起等待锁 vs 自旋锁(两者的使用场合)
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
What is the agile proportion of PMP Exam? Dispel doubts
剑指 Offer 06.从头到尾打印链表
Reverse one-way linked list of interview questions
质量体系建设之路的分分合合
Improvement of pointnet++
Insert sort
SAP-修改系统表数据的方法
26、 File system API (device sharing between applications; directory and file API)
剑指 Offer 53 - I. 在排序数组中查找数字 I
Haut OJ 1218: maximum continuous sub segment sum
剑指 Offer 35.复杂链表的复制
Introduction to tools in TF-A
Animation scoring data analysis and visualization and it industry recruitment data analysis and visualization
Demonstration of using Solon auth authentication framework (simpler authentication framework)