当前位置:网站首页>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;
}边栏推荐
- [转]: OSGI规范 深入浅出
- 第六章 数据流建模—课后习题
- Development error notes
- Heap sort summary
- [to be continued] [depth first search] 547 Number of provinces
- Reverse one-way linked list of interview questions
- [sum of two numbers] 169 sum of two numbers II - enter an ordered array
- Haut OJ 2021 freshmen week II reflection summary
- Solon Auth 认证框架使用演示(更简单的认证框架)
- Demonstration of using Solon auth authentication framework (simpler authentication framework)
猜你喜欢

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

Using HashMap to realize simple cache

YOLOv5-Shufflenetv2

剑指 Offer 05. 替换空格

Improvement of pointnet++

Bucket sort

Shell Sort
![[trans]: spécification osgi](/img/54/d73a8d3e375dfe430c2eca39617b9c.png)
[trans]: spécification osgi

sync.Mutex源码解读
![To be continued] [UE4 notes] L4 object editing](/img/0f/cfe788f07423222f9eed90f4cece7d.jpg)
To be continued] [UE4 notes] L4 object editing
随机推荐
To be continued] [UE4 notes] L4 object editing
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
26、 File system API (device sharing between applications; directory and file API)
A problem and solution of recording QT memory leakage
服务熔断 Hystrix
YOLOv5添加注意力機制
Service fusing hystrix
Haut OJ 1350: choice sends candy
Solon Logging 插件的添加器级别控制和日志器的级别控制
lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
剑指 Offer 58 - II. 左旋转字符串
剑指 Offer 04. 二维数组中的查找
Acwing 4300. Two operations
质量体系建设之路的分分合合
To the distance we have been looking for -- film review of "flying house journey"
[es practice] use the native realm security mode on es
Shell Sort
kubeadm系列-00-overview
对象的序列化
Web APIs DOM节点