首页 > 其他分享 >杭电ACM HDOJ 1039 Easier Done Than Said?

杭电ACM HDOJ 1039 Easier Done Than Said?

时间:2023-08-21 12:37:50浏览次数:57  
标签:Said return int acceptable ACM passwords str password Than


Easier Done Than Said?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6387    Accepted Submission(s): 3172


Problem 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.


 


 


Source


Mid-Central USA 2000


 


 


Recommend


We have carefully selected several similar problems for you:   1062  1073  1043  1088  1113 


 

 

#include <stdio.h>
#include <string.h>
int isvowel(char c){
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return 1;
    else
        return 0;
}
int isA(char str[]){
    int i=0,vowel=0,consonant=0,k;
    for(k=0;k<strlen(str);k++){
        if(isvowel(str[k])){
            i=1;
            vowel++;
            consonant=0;
            if(vowel>2)
                return 0;
        }
        else{
            consonant++;
            vowel=0;
            if(consonant>2)
                return 0;
        }
        if(str[k]!='e'&&str[k]!='o'&&str[k]==str[k+1])
            return 0;
    }
    if(!i)
        return 0;
    else
        return 1;
}
int main(){
    char str[25];
    while(~scanf("%s",str)){
        if(!strcmp(str,"end"))
            break;
        if(isA(str)){
            printf("<%s> is acceptable.\n",str);
        }
        else
            printf("<%s> is not acceptable.\n",str);
    }
}

 

标签:Said,return,int,acceptable,ACM,passwords,str,password,Than
From: https://blog.51cto.com/u_10101161/7173513

相关文章

  • 杭电ACM HDU 3351 Seinfeld
    SeinfeldTimeLimit:2000/1000MS(Java/Others)   MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1071   AcceptedSubmission(s):540ProblemDescriptionI’moutofstories.ForyearsI’vebeenwritingstories,somerathersilly,......
  • 西农2022级ACM招新考题
    准备放弃一段时间算法。西农2022级ACM招新上周结束了,五一假期研究了一下题解,整理发在博客。1.这真的是签到题print("\"ACMwelcomesyou\\n\"")2.4和数#include<bits/stdc++.h>usingnamespacestd;constintmaxn=1e6+10;intf[maxn+1];intl,r;boolche......
  • vue3 vite后台管理模板项目打包报错 Some chunks are larger than 500 KiB after mini
    ​ 1、错误原因分析:超过块大小限制,块大小默认500KB2、解决办法:在vite.config.js中增加output配置项build:{chunkSizeWarningLimit:1500,//调整包的大小rollupOptions:{output:{//最小化拆分包manualChunks(id){......
  • 20230818 CHAPTER 5 Thanks for the Memories arm64汇编内存使用
    .data段的内存引用实例十进制数不要以0开头,否则会被认为是8进制数一个数前面可以加-负号或者~取反符号; 申请一个内存块; 重复!转义字符!内存对齐  TheoffsetfromthePChas19bitsintheinstruction,whichgivesarangeof+/-1MB. Theoffsetaddress......
  • ChatGPT 问答00018 在Disruptor中,EventHandler使用案例
    在Disruptor中,EventHandler通常用于并行处理事件的场景。下面是一个简单的示例,展示了如何使用EventHandler:假设我们有一个RingBuffer,用于存储事件,并且有多个事件处理器需要并发地处理这些事件。我们定义一个名为Event的类作为事件对象,并创建多个EventHandler来处理这些事件。首......
  • ChatGPT 问答00019 在Disruptor中,EventHandler的onEvent方法的3个参数分别代表什么
    在Disruptor中,EventHandler的onEvent方法的三个参数分别代表以下内容:event:表示当前处理的事件对象。它是从RingBuffer中获取的事件,你可以通过event对象访问和处理事件所携带的数据。sequence:表示当前事件的序号。每个事件在RingBuffer中都有一个唯一的序号,用于标识事件的......
  • ChatGPT 问答00016 disruptor中的EventHandler和WorkHandler区别
    在Disruptor中,EventHandler和WorkHandler是两个关键的接口,用于定义对事件的处理方式。EventHandler(事件处理器):EventHandler是Disruptor框架中最基本的事件处理接口。它定义了单个事件的处理逻辑,即当事件被发布到RingBuffer时应该如何处理。框架会并发地将每个事件传递给所......
  • ACM模式输入输出处理
    cin遇到\n会停止读取但是不会读出来1.数组长度确定,多组数据直接一个while循环输入151020输出630while(cin>>a>>b){cout<<a+b<<endl;}第一个数表示组数的,直接给个size,然后for循环输入2151020输出6302.数组长度不确定','分......
  • ACM常见格式提取代码
    1.提取指定范围符号内用逗号隔开数字vector<int>trans(string&str){size_tstart=str.find('[');size_tend=str.find(']');stringnumStr=str.substr(start+1,end-start-1);stringstreamss(numStr);intnumber;......
  • mysql在开启group_replication后,报错ERROR 3092,This member has more executed transa
    问题描述:mysql在开启group_replication后,报错ERROR3092,Thismemberhasmoreexecutedtransactionsthanthosepresentinthegroup,如下所示:数据库:MySQL8.0.27系统:rhel7.31、异常重现Slave01[(none)]>startgroup_replication;ERROR3092(HY000):Theserverisnotc......