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的更多相关文章
随机推荐
- poj1006生理周期(中国剩余定理)
生理周期 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 139224 Accepted: 44687 Descripti ...
- [Swift通天遁地]五、高级扩展-(1)快速检测设备属性:版本、类型、屏幕尺寸
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 洛谷P1478 陶陶摘苹果(升级版)
题目数据范围小,开两个数组手写冒泡应该也能过,不过和之前在牛客上的一题类似用结构体数组就好了,主要是注意用结构体数组的排序 题目 题目描述 又是一年秋季时,陶陶家的苹果树结了n个果子.陶陶又跑去摘苹果 ...
- go 学习成长之路
一.go的搭建 二.初识go 三.混个脸熟--go 四.go的语言结构 五.go的常量与变量 六.go基础数据类型 七.go 条件语句 八.go 运算符 九.go条件语句switch 十.go循环语句 ...
- ACM_Mystery
Mystery Time Limit: 2000/1000ms (Java/Others) Problem Description: No Description Input: The first l ...
- 【Leetcode 3】Longest Substring Without Repeating Characters0
Description: Given a string, find the length of the longest substring without repeating characters. ...
- V3的普通窗体控件的使用
1.文本: 属性: 标签对齐方式: Left Right Center 值对齐方式: Left Right Center 事件: 值改变事件 值加载事件 单击标题事件 键盘按下事件 获得焦点事 ...
- 在VirtualBox上安装Solaris 10全教程(包括下载)
您可以在博文的最下方留下评价, 也可以点击左边的 关注 来关注我的博客的最新动态. 如果文章内容对您有帮助, 不要忘记点击右下角的 推荐 来支持一下喔 如果您对博文有任何疑问, 可以通过评论或发邮件的 ...
- html5——网络状态
我们可以通过window.onLine来检测,用户当前的网络状况,返回一个布尔值 window.addEventListener("online",function(){ aler ...
- JS——正则
正则的声明: 1.构造函数:var 变量名= new RegExp(/表达式/); 2.直接量:var 变量名= /表达式/; test()方法: 1.正则对象方法,检测测试字符串是否符合该规则,返回 ...