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 ...
随机推荐
- 159. Longest Substring with At Most Two Distinct Characters
最后更新 二刷 08-Jan-17 回头看了下一刷的,用的map,应该是int[256]的意思,后面没仔细看cuz whatever I was doing at that time.. wasnt ...
- 【转】The Zen of Python
http://www.python.org/dev/peps/pep-0020/ Beautiful is better than ugly. Explicit is better than impl ...
- UOJ #142. 【UER #5】万圣节的南瓜灯 并查集
#142. [UER #5]万圣节的南瓜灯 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://uoj.ac/problem/142 Descrip ...
- Codeforces Round #328 (Div. 2) D. Super M 虚树直径
D. Super M Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/problem/D ...
- BZOJ 2456: mode 水题
2456: mode Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php? ...
- 用C#调用Matlab图像处理自制QQ游戏2D桌球瞄准器
平时不怎么玩游戏,有时消遣就玩玩QQ里的2D桌球,但是玩的次数少,不能像骨灰级玩家一样百发百中,肿么办呢?于是某天突发奇想,决定自己也来做个“外挂”.说是外挂,其实只是一个瞄准器,毕竟外挂是修改别人的 ...
- 为joomla加入下拉菜单的方法
用 Joomla! 建站的大多数站长都须要在站点前台使用下拉菜单(dropdown menu),或者叫弹出菜单(slide menu),由于这样能够在有限的页面空间上公布很多其它的导航菜单,而且能够进 ...
- mysql优化:连接数
有时候我们会遇见"MySQL: ERROR 1040: Too many connections"的异常,一种原因是訪问量过高,MySQLserver抗不住,这个时候就要考虑添加从 ...
- [AngularJS] Consistency between ui-router states and Angular directives
ui-router's states and AngularJS directives have much in common. Let's explores the similarities bet ...
- android145 360 进程管理
package com.itheima.mobileguard.activities; import java.util.ArrayList; import java.util.List; impor ...