HDU 1039.Easier Done Than Said?-条件判断字符串
Easier Done Than Said?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16543 Accepted Submission(s): 7846
FnordCom is developing such a password generator. You work in the quality control department, and it's your job to test the generator and make sure that the passwords are acceptable. To be acceptable, a password must satisfy these three rules:
It must contain at least one vowel.
It cannot contain three consecutive vowels or three consecutive consonants.
It cannot contain two consecutive occurrences of the same letter, except for 'ee' or 'oo'.
(For the purposes of this problem, the vowels are 'a', 'e', 'i', 'o', and 'u'; all other letters are consonants.) Note that these rules are not perfect; there are many common/pronounceable words that are not acceptable.
tv
ptoui
bontres
zoggax
wiinq
eep
houctuh
end
<tv> is not acceptable.
<ptoui> is not acceptable.
<bontres> is not acceptable.
<zoggax> is not acceptable.
<wiinq> is not acceptable.
<eep> is acceptable.
<houctuh> is acceptable.
代码:
#include<stdio.h>
#include<string.h>
int main(){
char a[];
int i,num,flag,len;
int b[];
while(~scanf("%s",&a)&&strcmp("end",a)){
for(i=;i<;i++)
b[i]=;
num=;
flag=;
len=strlen(a);
for(i=;i<len;i++){
if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'){
b[i]=;
num+=;
}
else
b[i]=;
}
for(i=;i<len;i++){
if(b[i]==b[i-]&&b[i-]==b[i-]){
flag=;
break;
}
}
for(i=;i<len;i++){
if(a[i]==a[i-]&&a[i]!='e'&&a[i]!='o'){
flag=;
break;
}
}
if(num==||flag==)
printf("<%s> is not acceptable.\n",a);
else
printf("<%s> is acceptable.\n",a);
}
return ;
}
最新文章
- C#和C实现通过CRC-16 (Modbus)获取CRC值并校验数据(代码)
- Selenium2学习-039-WebUI自动化实战实例-文件上传下载
- [转]使用Stopwatch类实现高精度计时
- Java 使用Redis缓存工具的图文详细方法
- js数据类型和关系运算语法
- C# 连接SQL数据库 常用连接字符串
- Java学习笔记25(System类)
- f.lux——自动调整屏幕色温减少眼睛疲劳,长时间玩电脑必备!
- 阿里云API网关(5)用户指南(调用 API)
- bzoj3309DZY Loves Math
- css3 resize属性
- HTTP/2 资料汇总
- 迁移svn项目到git
- 连接centos服务器gui
- 20171205xlVBA往返航班组合
- 关于阿里云和ucloud云服务器负载均衡器slb和ulb会话保持的配置
- python 怎么模拟加header(如User-Agent、Content-Type等等)
- javascript的实现事件的一些实例
- 使用Visual Studio2013打开Visual Studio2015项目
- HDU 2087 剪花布条(字符串匹配,KMP)