hdu_1039_Easier Done Than Said_201311051511
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
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.
#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的更多相关文章
随机推荐
- windows2003下svn的安装
Windows2003下svn平台搭建 编辑:dnawo 日期:2010-08-03 转自http://www.mzwu.com/article.asp?id=2557 字体大小: 小 中 大 ...
- 关于网页的自适应问题一---Media Query(媒介查询)
1.Media Query(媒介查询) 通过不同的媒介类型和条件定义样式表规则.媒介查询让CSS可以更精确作用于不同的媒介类型和同一媒介的不同条件.媒介查询的大部分媒介特性都接受min和max用于表达 ...
- Jquery和Ajax的关系!
Jquery是一种JavaScript框架,而Ajax(Asynchronous JavaScript and XML)是异步JavaScript和XML. Jquery是JavaScript的框架, ...
- 给定的逗号分隔的数字字符串转换为Table
--将给定的逗号分隔的数字字符串转换为Table CREATE FUNCTION [dbo].[fu_Split](@strString nvarchar(4000)) RETURNS @Result ...
- 元素属性的添加删除(原生js)
添加属性 odiv.setAttribute("title","hello div!"); odiv.setAttribute("class" ...
- Java中常用的操作PDF的类库
iText iText是一个能够快速产生PDF文件的java类库.iText的java类对于那些要产生包含文本,表格,图形的只读文档是很有用的.它的类库尤其与java Servlet有很好的给合.使用 ...
- Android项目实战_手机安全卫士流量统计
## 1.抽屉控件SlidingDrawer:一定要配置android:handle(把手)和android:content(内容),并在子View中添加把手和内容的布局```java <Sli ...
- Appium Python API 汇总
最近在学习Python自动化,网络搜集而来,留着备用, 方便自己也方便他人.感谢总结的人! 1.contexts contexts(self): Returns the contexts within ...
- 12、scala函数式编程集合
1.Scala的集合体系结构 2.List 3.LikedList 4.Set 5.集合的函数式编程 6.函数式编程综合案例:统计单词总数 1.Scala的集合体系结构 Scala中集合体系主要包括: ...
- (转)Hibernate关联映射——对象的三种关系
http://blog.csdn.net/yerenyuan_pku/article/details/70148618 Hibernate关联映射——对象的三种关系 Hibernate框架基于ORM设 ...