1658: Easier Done Than Said?

1658: Easier Done Than Said?

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 15  Solved: 12
[Submit][Status][Web Board]

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>

int yuanyin(char c)
{
    if(c==‘a‘||c==‘e‘||c==‘i‘||c==‘o‘||c==‘u‘)    return 1;
    return 0;
}

int is_yuanyin(char a[])
{
    int i,len=strlen(a);
    for( i=0; i<len; i++)
        if( yuanyin(a[i]) )return 1;
    return 0;
}

int lianxu(char a[])
{
    int i,len = strlen(a);
    for(i=0;i<len;i++)
    {
        if ( i+2 < len && yuanyin(a[i]) && yuanyin(a[i+1]) && yuanyin(a[i+2]))
            return 0;
        if ( i+2 < len && !yuanyin(a[i]) && !yuanyin(a[i+1]) && !yuanyin(a[i+2]))
            return 0;
    }
    return 1;
}

int xiangtong(char a[])
{
    int i, len=strlen(a);
    for( i=0; i<len ; i++)
    {
        if(i+1<len && a[i]==a[i+1] && a[i]!=‘e‘ && a[i]!=‘o‘)
            return 0;
    }
    return 1;
}

int main()
{
    char a[100];
    int len,i;
    while(scanf("%s",a)!=EOF){
            if( strcmp(a,"end")==0) break;
            if(is_yuanyin(a)&&lianxu(a)&&xiangtong(a))
                printf("<%s> is acceptable.\n",a);
            else
                printf("<%s> is not acceptable.\n",a);
    }

}

  

原文地址:https://www.cnblogs.com/mjn1/p/8436871.html

时间: 2024-09-30 07:33:21

1658: Easier Done Than Said?的相关文章

Easier Done Than Said?(杭电oj1039)

Easier Done Than Said? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8339    Accepted Submission(s): 4093 Problem Description Password security is a tricky thing. Users prefer simple password

HDU1039 Easier Done Than Said?

Easier Done Than Said? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7822    Accepted Submission(s): 3863 Problem Description Password security is a tricky thing. Users prefer simple password

ural 1356. Something Easier 哥德巴赫猜想

1356. Something Easier Time limit: 1.0 secondMemory limit: 64 MB “How do physicists define prime numbers? Very easily: prime numbers are the number 2 and all the odd numbers greater than 2. They may show that this definition corresponds to the mathem

籍工作助你避免犯错误CSoft.PlanTracer.Pro.v7.0.2870.1658.662

地籍工作助你避免犯错误CSoft.PlanTracer.Pro.v7.0.2870.1658.662     它支持自动生成的数据包发送AIS GKN电子签名卸货.该程序允许您执行地籍工作的会计对象的任何复杂度和体积,如多回路,集成或扩展的对象,由成千上万的轮廓和特征点组成.这个软件不仅容易产生必要的文件,而且还可以帮助你避免犯错误.图形编辑器包含一个独特的功能,用于与地面,应急计划和线性网络,以及用于处理和识别扫描图像的工具.plantracer亲的一系列专业工具地籍工程师的旗舰产品,旨在创造

[题解]uva 1658 Admiral

vjudge传送门[here] 题目大意:给一个有(3≤v≤1000)个点e(3≤e≤10000)条边的有向加权图,求1~v的两条不相交(除了起点和终点外没有公共点)的路径,使权值和最小. 正解是吧2到v-1的每个点拆成两个点,中间连一条容量为1,费用为0的边,然后求1到v的流量为2的最小费用流就行了. Code 1 /** 2 * Uva 3 * Problem#1658 4 * Accepted 5 */ 6 #include<iostream> 7 #include<cstdio&

uva 1658 Admiral (最小费最大流)

uva 1658 Admiral 题目大意:在图中找出两条没有交集的线路,要求这两条线路的费用最小. 解题思路:还是拆点建图的问题. 首先每一个点都要拆成两个点.比如a点拆成a->a'.起点和终点的两点间的容量为2费用为0,保证了仅仅找出两条线路.其余点的容量为1费用为0,保证每点仅仅走一遍,两条线路无交集.然后依据题目给出的要求继续建图.每组数据读入a, b, c, 建立a'到b的边容量为1, 费用为c.图建完之后,用bellman-ford来实现MCMF. #include <cstdio

Little things that can make your life easier in 2016

作为今年的结束,向你推荐一些工具,可以添加到你的iOS开发工具箱,并可以让你2016年的开发变得更容易.更高效. 使用用户断点的力量 我们使用断点的地方有很多,但我发现大多数朋友只使用常规断点进行调试. 实际上,还有很多你能用的地方,例如你可以把普通断点提升为用户断点,并且在你所有的项目中使用,为什么不这么做呢? 因为你可以在执行代码中创建一个特定的符号断点,例如UIApplicationMain: 看到我做了些什么吗? 现在每当调试任何的项目,我已经不这么做了: 我直接这么处理: 没有额外的步

POJ 1658 Eva&#39;s Problem

Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17778   Accepted: 10871 Description Eva的家庭作业里有很多数列填空练习.填空练习的要求是:已知数列的前四项,填出第五项.因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习. Input 第一行是数列的数目t(0 <= t <= 20).以下每行均包含四个整数,表示数列的前四项.约定数列的前五项均为不大于10^5的

遇到 ORACLE 错误 1658

在对oracle导入数据时,多次报以下错误: IMP-00003: 遇到 ORACLE 错误 1659 ORA-01659: 无法分配超出 1 的 MINEXTENTS (在表空间 ZSTA_DATA_TBS 中) IMP-00003: 遇到 ORACLE 错误 1658 ORA-01658: 无法为表空间 ZSTA_DATA_TBS 中的段创建 INITIAL 区 报错原因: 表空间ZSTA_DATA_TBS已经用完 解决办法: 将表空间ZSTA_DATA_TBS修改为自动增长 ALTER D