hdu 2027统计元音
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027
思路:主要考察gets()函数用法,能够接受输入的空格,如果用%s或是cin>>str都不能输入空格
#include <cstdio>
#include <iostream>
#include<algorithm>
#include<math.h>
#include <string.h>
#include<queue>
using namespace std; int main()
{
int a,e,i,o,u;
int num;
char str1[];
while(scanf("%d",&num)!=EOF)
{
getchar(); //吸收回车
for(int j=;j<num;j++)
{
memset(str1,'\0',sizeof(str1));
a=e=i=o=u=;
gets(str1); //gets可以读入空格 for(int j=;j<strlen(str1);j++)
{
if(str1[j] == 'a')
a++;
else if(str1[j] == 'e')
e++;
else if(str1[j] == 'i')
i++;
else if(str1[j] == 'o')
o++;
else if(str1[j] == 'u')
u++;
}
if(j == num-)
{
printf("a:%d\n",a);
printf("e:%d\n",e);
printf("i:%d\n",i);
printf("o:%d\n",o);
printf("u:%d\n",u);
}
else
{
printf("a:%d\n",a);
printf("e:%d\n",e);
printf("i:%d\n",i);
printf("o:%d\n",o);
printf("u:%d\n\n",u);
}
}
}
return ;
}
hdu 2027统计元音的更多相关文章
- hdu 2027 统计元音
统计元音 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- HDOJ 2027 统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...
- ACM: HDU 2563 统计问题-DFS+打表
HDU 2563 统计问题 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u HDU 2 ...
- ytu 1939:统计元音(水题)
统计元音 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 68 Solved: 33[Submit][Status][Web Board] Descrip ...
- HDOJ2027统计元音
统计元音 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- LeetCode 5216. 统计元音字母序列的数目(Java)DP
5216. 统计元音字母序列的数目 给你一个整数 n,请你帮忙统计一下我们可以按下述规则形成多少个长度为 n 的字符串: 字符串中的每个字符都应当是小写元音字母('a', 'e', 'i', 'o', ...
- HDU 2027 汉字统计
汉字统计 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- hdu 1251 统计难题 (字典树入门题)
/******************************************************* 题目: 统计难题 (hdu 1251) 链接: http://acm.hdu.edu. ...
- HDU 1251 统计难题(Trie模版题)
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Subm ...
随机推荐
- AChartEngine 安卓折线图 柱形图等利器
http://www.eoeandroid.com/thread-548233-1-6.html 最近公司项目中要用到折线图,状态类型的图标要用到折线图,柱形图等,并且能够动态显示,在网上找了许多de ...
- python 集合 -----直接用逗号连接的是元组,不是list
t = 12345, 54321, 'hello!' >>> t[0] 12345 >>> t (12345, 54321, 'hello!') 元组:元组由逗号分 ...
- Android学习之路书籍推荐
Android开发书籍推荐:从入门到精通系列学习路线书籍介绍 JAVA入门书籍: < Introduction to java programming > < Core java & ...
- (转)android图片压缩总结
原文地址:http://blog.csdn.net/cherry609195946/article/details/9264409 一.图片的存在形式 1.文件形式(即以二进制形式存在于硬盘上)2.流 ...
- 2. Android系统启动流程
1.启动加载完内核 2.执行init进程 ----> 设备初始化工作 a1. 读取inic.rc a2. 启动Zygote进程 ----> 该进程是所有进程的孵 ...
- Python操作excel,及图表展示
学习:http://www.cnblogs.com/Lands-ljk/p/5444619.html
- c++写入txt文件
简单方式: #include "stdafx.h" #include <iostream> #include <iomanip> #include < ...
- VMware12中CentOS7网络设置
VMware提供了三种将虚拟网卡和物理网卡捆绑起来的方式,即桥接(Bridge)模式,网络地址转换(Network Address Transformation, NAT)模式和主机(Host Onl ...
- C#操作txt文件
目的:txt文件的创建,读写操作 功能:创建一个winform窗体,当文件不存在时可以实现txt文件的创建 效果: 代码: 文件的创建(判断文件是否存在,不存在则创建新的文本文件): private ...
- 关于fill_parent,match_parent和wrap_content (转载)
fill_parent&match_parent: 在Android2.2及以上版本中,fill_parent与match_parent意思相同(其中fill_parent兼容低版本).都是尽 ...