HDOJ2027统计元音
统计元音
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 34610 Accepted Submission(s): 14259
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
aeiou
my name is ignatius
e:1
i:1
o:1
u:1
a:2
e:1
i:3
o:0
u:1
解题报告:
水题,遍历每个字符串的字母,用switch case解决。开一个一维数组保存元音的个数。
- #include <stdio.h>
- int main()
- {
- int i,n,a[];
- char s[];
- scanf("%d",&n);
- while(n--)
- {
- for(i=;i<;i++)
- a[i]=;
- scanf("%s",s);
- for(i=;s[i];i++)
- {
- switch(s[i])
- {
- case 'a':a[]++;break;
- case 'e':a[]++;break;
- case 'i':a[]++;break;
- case 'o':a[]++;break;
- case 'u':a[]++;break;
- }
- }
- printf("a:%d\ne:%d\ni:%d\no:%d\nu:%d\n",a[],a[],a[],a[],a[]);
- if(n)
- printf("\n");
- }
- return ;
- }
HDOJ2027统计元音的更多相关文章
- ytu 1939:统计元音(水题)
统计元音 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 68 Solved: 33[Submit][Status][Web Board] Descrip ...
- hdu 2027 统计元音
统计元音 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- LeetCode 5216. 统计元音字母序列的数目(Java)DP
5216. 统计元音字母序列的数目 给你一个整数 n,请你帮忙统计一下我们可以按下述规则形成多少个长度为 n 的字符串: 字符串中的每个字符都应当是小写元音字母('a', 'e', 'i', 'o', ...
- HDOJ 2027 统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...
- HDU_2027——统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output ...
- HDU2027:统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...
- 统计元音(stringstream的-应用)
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output ...
- OpenJudge计算概论-求字母的个数(统计元音字母个数)
/*======================================================================= 求字母的个数 总时间限制: 1000ms 内存限制: ...
- hdu 2027统计元音
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027 思路:主要考察gets()函数用法,能够接受输入的空格,如果用%s或是cin>>st ...
随机推荐
- eclipse scons 使用指南
http://sconsolidator.com/projects/sconsolidator/wiki/Getting_Started Add SCons support to an existin ...
- linux常用命令-搜索
1.find $ find . -name nginx* $ find . -name nginx* -ls $ find . -type f -mmin -10 搜索当前目录中,所有过去10分钟中更 ...
- 实现Android半透明Menu效果的开发实例
不知道大家是否用过天天动听,对于它界面上的半透明Menu效果,笔者感觉非常漂亮.下面是天天动听半透明Menu的截图,欣赏下吧: 感觉还不错吧?那么如何实现这种半透明Menu效果呢?本文就重点讨论并给出 ...
- [Angular 2] Factory Provider with dependencies
This lesson discusses when and how to add dependencies, resolved by Angular’s DI, to factory provide ...
- ios开发——实用技术篇Swift篇&录音
录音 // MARK: - 录音 /*----- 录音 ------*/ var recorder:AVAudioRecorder? //录音器 var player:AVAudioPlayer? / ...
- LeetCode: Reverse Words in a String:Evaluate Reverse Polish Notation
LeetCode: Reverse Words in a String:Evaluate Reverse Polish Notation Evaluate the value of an arithm ...
- 【完结】利用 Composer 完善自己的 PHP 框架(三)——Redis 缓存
本教程示例代码见 https://github.com/johnlui/My-First-Framework-based-on-Composer 回顾 上两篇文章中我们完成了 View 视图加载类和 ...
- iOS 开发常用宏
来源:iOS_小松哥 链接:http://www.jianshu.com/p/be00c3f3cafd 大家都是知道使用宏不仅方便,而且可以提高开发效率.下面总结了iOS开发过程中的一些常用宏,会持续 ...
- A very hard Aoshu problem
A very hard Aoshu proble Problem Description Aoshu is very popular among primary school students. It ...
- 安装DirectX SDK时出现Error Code:s1023 的解决方案
刚刚安装DXSDK_Jun10时(下载地址:http://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458 ...