HDU1039 Easier Done Than Said?
Problem Description
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
Output
Sample Input
Sample Output
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <ctype.h> using namespace std; int judge(char a)
{
if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
return ;
return ;
} int main()
{
char word[]; while(scanf("%s",word)!=EOF&&strcmp(word,"end"))
{
int l=strlen(word),i,flag=; for(i=;i<l;i++)
{
if(judge(word[i]))
flag=;
}
if(flag==)
{
for(i=;i<l-;i++)
{
if(word[i]==word[i+]&&word[i]!='e'&&word[i]!='o')
{
flag=;
}
} if(flag==)
printf("<%s> is not acceptable.\n",word);
else
{
for(i=;i<l-;i++)
{
if((judge(word[i])&&judge(word[i+])&&judge(word[i+]))||(!judge(word[i])&&!judge(word[i+])&&!judge(word[i+])))
{
flag=;
}
}
if(flag==)
printf("<%s> is not acceptable.\n",word);
else
printf("<%s> is acceptable.\n",word);
}
}
else
printf("<%s> is not acceptable.\n",word);
}
return ;
}
HDU1039 Easier Done Than Said?的更多相关文章
- HBase官方文档
HBase官方文档 目录 序 1. 入门 1.1. 介绍 1.2. 快速开始 2. Apache HBase (TM)配置 2.1. 基础条件 2.2. HBase 运行模式: 独立和分布式 2.3. ...
- hdu 1039 Easier Done Than Said? 字符串
Easier Done Than Said? Time Limi ...
- ural 1356. Something Easier(数论,哥德巴赫猜想)
1356. Something Easier Time limit: 1.0 secondMemory limit: 64 MB “How do physicists define prime num ...
- (转)Is attacking machine learning easier than defending it?
转自:http://www.cleverhans.io/security/privacy/ml/2017/02/15/why-attacking-machine-learning-is-easier- ...
- HDU 1039.Easier Done Than Said?-条件判断字符串
Easier Done Than Said? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/O ...
- 1658: Easier Done Than Said?
1658: Easier Done Than Said? Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 15 Solved: 12[Submit][St ...
- HDU 1039.Easier Done Than Said?【字符串处理】【8月24】
Easier Done Than Said? Problem Description Password security is a tricky thing. Users prefer simple ...
- 使 Excel 规则更容易理解(Oracle Policy Modeling-Make your Excel rules easier to understand)
有以下几种方法可以使 Excel 规则更容易理解. 在 Excel 工作簿中缩短属性名称 您可以使用图例关键字创建在 Excel 中引用属性的缩写方式.可以根据情况指定此缩写形式. 要指定图例关键字, ...
- HDU 2671 Can't be easier(数学题,点关于直线对称)
题目 //数学题//直线 y = k * x + b//直线 ax+by+c=0; 点 (x0,y0); 点到直线距离 d = (ax0+by0+c)/sqrt(a^2+b^2) /********* ...
随机推荐
- java 字符串全排列 和 去重
用递归进行排序 , 用TreeSet 去重. public class test { public static void main(String []args){ String str = &quo ...
- 【VC6.0】getline需要输入2次回车才会结束的BUG修复方法
原始日期:2013-09-30 23:22 今天看C++Primer的时候发现一个问题,getline需要输入2次回车才会显示结果,上网找了一下,发现是VC6.0的原因,修复原因如下: (1)建立一个 ...
- java架构师负载均衡、高并发、nginx优化、tomcat集群、异步性能优化、Dubbo分布式、Redis持久化、ActiveMQ中间件、Netty互联网、spring大型分布式项目实战视频教程百度网盘
15套Java架构师详情 * { font-family: "Microsoft YaHei" !important } h1 { background-color: #006; ...
- Petya勒索病毒疫苗出现,分分钟让电脑对病毒免疫
继wannacry之后,Petya勒索软件攻击再次席卷全球,对欧洲.俄罗斯等多国政府.银行.电力系统.通讯系统.企业以及机场造成了不同程度的影响. 研究发现,Petya 会锁定磁盘的 MFT 和 MB ...
- 如何退出 Vim
点击 Esc 键,; Vim 进入命令模式.然后输入: :q 退出(这是 :quit 的缩写) :q! 不保存退出(这是 :quit! 的缩写) :wq 写入文件并退出:(这是 :writequi ...
- linux下安装apache最常见的报错解决
报错如下: Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, ...
- 1.免费安装myeclipse 10以及破解
1.材料准备 jdk1.8.0_101 网盘地址链接: http://pan.baidu.com/s/1ge8Jaz5 密码: qb6v myeclipse-10.6-offline-installe ...
- AngularJS服务和路由
colnplie 网页加载的出现一次 link 元素每次改变的时候 **$watch** 监听列表 $scope.$watch("name",functio ...
- 可满足性模块理论(SMT)基础 - 01 - 自动机和斯皮尔伯格算术
可满足性模块理论(SMT)基础 - 01 - 自动机和斯皮尔伯格算术 前言 如果,我们只给出一个数学问题的(比如一道数独题)约束条件,是否有程序可以自动求出一个解? 可满足性模理论(SMT - Sat ...
- 基于Json序列化和反序列化通用的封装
1. 最近项目已经上线了 ,闲暇了几天 想将JSON的序列化以及反序列化进行重新的封装一下本人定义为JSONHelp,虽然Microsoft 已经做的很好了.但是我想封装一套为自己开发的项目使用.方便 ...