Easier Done Than Said?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6333    Accepted Submission(s): 3145

Problem Description
Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated passwords (like xvtpzyo), but users have a hard time remembering them and sometimes leave them written on notes stuck to their computer. One potential solution is to generate "pronounceable" passwords that are relatively secure but still easy to remember.
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.
 
Input
The input consists of one or more potential passwords, one per line, followed by a line containing only the word 'end' that signals the end of the file. Each password is at least one and at most twenty letters long and consists only of lowercase letters.
 
Output
For each password, output whether or not it is acceptable, using the precise format shown in the example.
 
Sample Input
a
tv
ptoui
bontres
zoggax
wiinq
eep
houctuh
end
 
Sample Output
<a> is acceptable.
<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> char str[]; int f(char c)
{
if(c=='a')
return ;
else if(c=='e')
return ;
else if(c=='i')
return ;
else if(c=='o')
return ;
else if(c=='u')
return ;
else
return ;
} int consecutive(char a,char b,char c)
{
int t;
t=f(a)+f(b)+f(c);
if(t==||t==)
return ;
else
return ;
}
int main()
{
memset(str,,sizeof(str));
while(scanf("%s",str),strcmp(str,"end")!=)
{
int i,j,k=,t1=,t2=;
int len;
printf("<%s> ",str);
len = strlen(str);
for(i=;i<len;i++)
{
if(str[i]=='a')
k++;
else if(str[i]=='e')
k++;
else if(str[i]=='i')
k++;
else if(str[i]=='o')
k++;
else if(str[i]=='u')
k++;
if(i+<len)
{
if(consecutive(str[i],str[i+],str[i+]))
{
printf("is not acceptable.\n");
break;
}
}
if(str[i+]==str[i])
{
if(str[i]=='e'||str[i]=='o')
i++;
else
{
printf("is not acceptable.\n");
break;
}
}
}
if(k==&&i>=len)
printf("is not acceptable.\n");
if(k>&&i>=len)
printf("is acceptable.\n");
}
return ;
}
没有想象中的那么难,其实是一道简单题

hdu_1039_Easier Done Than Said_201311051511的更多相关文章

随机推荐

  1. 【转】pycharm常用快捷键

    转自:http://www.2cto.com/os/201410/341542.html 转来珍藏着,以后慢慢完善. 编辑类: Ctrl + Space 基本的代码完成(类.方法.属性)Ctrl + ...

  2. E20170619-hm

    bucket   n. 水桶; open hash  [词典] [计] 开放散列,开混列; spirit   n. 精神,心灵; 情绪; 勇气; 精髓; flesh   n. 肉; 肉体; 果肉; 皮 ...

  3. [Apple开发者帐户帮助]七、注册设备(1)注册一个设备

    您需要已注册的设备来创建开发或临时配置文件.要使用开发人员帐户注册设备,您需要拥有设备名称和设备ID. 注意:如果您使用自动签名,Xcode会为您注册连接的设备.Xcode Server也可以配置为注 ...

  4. [Swift通天遁地]四、网络和线程-(6)检测网络连接状态

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  5. JavaScript--编程

    第一步:把注释语句注释. 第二步:编写代码,在页面中显示 “系好安全带,准备启航--目标JS”文字: 第三步:编写代码,在页面中弹出提示框“准备好了,起航吧!” 提示: 可以把弹框方法写在函数里. 第 ...

  6. SCOI2014题解

    SCOI2014由极不靠谱的电子坑爹大学出题.电子坑爹大学打破了多年行规,暴力+NOIP500分居然不能进队.极其逗比的第一天暴力给10分!!还好有些题不是很难,省队爷分数大概在150以上(最高420 ...

  7. Android源码下载方法

    1. 下载 repo 工具 mkdir ~/bin PATH=~/bin:$PATH curl https://storage.googleapis.com/git-repo-downloads/re ...

  8. java中使用String的replace方法替换html模板保存文件

    在我们的D盘下有这样一个html模板,现在我们要做的就是解析news.template文件,从数据库中提取数据将数据添加到指定的模板位置上 <head> <title>{tit ...

  9. MySQL索引----数据结构及算法原理

    摘要 本文以MySQL数据库为研究对象,讨论与数据库索引相关的一些话题.特别需要说明的是,MySQL支持诸多存储引擎,而各种存储引擎对索引的支持也各不相同,因此MySQL数据库支持多种索引类型,如BT ...

  10. [ SCOI 2005 ] 最大子矩阵

    \(\\\) \(Description\) 给出一个\(N\times M\)的有权矩阵,选出其中\(K\)个互不重叠的子矩阵,使得这\(K\)个子矩阵的权值和最大. \(N\in [1,100]\ ...