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) /********* ...
随机推荐
- HTML5 jQuery+FormData 异步上传文件,带进度条
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <link href ...
- 配置lnmp
===================准备篇: 1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A INPUT -m state –state NEW ...
- CSS设置一行文字,超出部分自动隐藏
.textone { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; line-height: 25px; max-h ...
- v9更新栏目缓存提示PHP has encountered a Stack overflow解决方法
原因: 客户在把一些栏目删除或者新增栏目时没更新栏目缓存导致v9_category表里有原来的垃圾信息,多余的表. 解决方法:通过phpmyadmin找到栏目表出错的条目,修改错误信息. 具体步骤: ...
- ecshop循环计数
循环依次递增+1 <!-- {foreach from=$comments item=comment name=comment} --> {$smarty.foreach.comment. ...
- Sqlserver 2005 跨数据库 导入数据
--Sqlserver 2005 跨数据库 导入数据:--SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/O ...
- jQuery淡入淡出的轮播图
html结构: <div class="banna"> <ul class="img"> ...
- php后台数组foreach嵌套循环
<?php foreach($list as $key=>$val){ ?> <tr class="over_odd"> <td align=& ...
- 转载: C++ 获取文件夹下的所有文件名
最近需要得到某个文件夹下所有文件名,于是就上网上查了查,得到如下的解决方案最多: 而且查到的最早的版本是这个:http://blog.csdn.net/cxf7394373/article/detai ...
- 【Android Developers Training】 71. 显示翻牌动画
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...