hdu 2027 统计元音
2015-01-12 17:19
267 查看
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=2027
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 42131 Accepted Submission(s): 17201
Problem Description
统计每个元音字母在字符串中出现的次数。
Input
输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串。
Output
对于每个测试实例输出5行,格式如下:
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
Sample Input
Sample Output
Author
lcy
Source
C语言程序设计练习(四)
Recommend
lcy | We have carefully selected several similar problems for you: 1062 1090 1256 1860 1020
统计元音
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 42131 Accepted Submission(s): 17201
Problem Description
统计每个元音字母在字符串中出现的次数。
Input
输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串。
Output
对于每个测试实例输出5行,格式如下:
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
Sample Input
2 aeiou my name is ignatius
Sample Output
a:1 e:1 i:1 o:1 u:1 a:2 e:1 i:3 o:0 u:1
Author
lcy
Source
C语言程序设计练习(四)
Recommend
lcy | We have carefully selected several similar problems for you: 1062 1090 1256 1860 1020
#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int MAXN = 110; int main() { char str[MAXN]; int i, iNum1, iNum2, iNum3, iNum4, iNum5, T; scanf("%d", &T); getchar(); while(T--)//从这几题可以看出,就是练习gets和getchar的应用 { gets(str); int iLen = strlen(str); iNum1 = 0, iNum2 = 0, iNum3 = 0, iNum4 = 0, iNum5 = 0; for(i = 0; i < iLen; ++i) { if(str[i] == ' ') continue; if(str[i] == 'a') iNum1++; else if(str[i] == 'e') iNum2++; else if(str[i] == 'i') iNum3++; else if(str[i] == 'o') iNum4++; else if(str[i] == 'u') iNum5++; } printf("a:%d\ne:%d\ni:%d\no:%d\nu:%d\n", iNum1, iNum2, iNum3, iNum4, iNum5); if(T) printf("\n"); } return 0; }
相关文章推荐
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 - 统计元音
- hdu_2027_统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- hdu 2027 统计元音 (java)
- HDU 2027 统计元音
- hdu 2027 统计元音 20140728.cpp
- Hdu 2027 - 统计元音
- HDU——2027 ——统计元音
- HDU 2027 -- 统计元音
- HDU_2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- 统计元音(hdu 2027)
- HDU_2027——统计元音