Easier Done Than Said?

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.
 
 1 #include <stdio.h>
 2 #include <string.h>
 3 
 4 int main(){
 5     char s[21];
 6     int length;
 7     int i;
 8     int flag1;
 9     int flag2;
10     int flag3;
11     char compareString[6]="aeiou";
12 
13     while(1){
14         scanf("%s",s);
15 
16         if(strcmp(s,"end")==0)
17             break;
18 
19         length=strlen(s);
20         flag1=0;
21         flag2=0;
22         flag3=0;
23 
24         for(i=0;i<length;i++){
25             if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')
26                 flag1=1;
27         }
28 
29         if(flag1==0){
30             printf("<%s> is not acceptable.\n",s);
31             continue;
32         }
33 
34         for(i=0;i<length-1;i++){
35             if(s[i]==s[i+1] && s[i]!='e' && s[i]!='o')
36                 flag2=1;
37         }
38 
39         if(flag2==1){
40             printf("<%s> is not acceptable.\n",s);
41             continue;
42         }
43 
44         for(i=0;i<length-2;i++){
45             if(strchr(compareString,s[i])!=NULL && strchr(compareString,s[i+1])!=NULL && strchr(compareString,s[i+2])!=NULL){
46                 flag3=1;
47                 break;
48             }
49 
50             if(strchr(compareString,s[i])==NULL && strchr(compareString,s[i+1])==NULL && strchr(compareString,s[i+2])==NULL){
51                 flag3=1;
52                 break;
53             }
54             
55         }
56 
57         if(flag3==1){
58             printf("<%s> is not acceptable.\n",s);
59             continue;
60         }
61 
62         printf("<%s> is acceptable.\n",s);
63 
64 
65     }
66     return 0;
67 }

 

 

转载于:https://www.cnblogs.com/zqxLonely/p/4086757.html

『杭电1039』Easier Done Than Said? 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 阅读详情

相关推荐

XilinxVirtualCable

Xilinx虚拟电缆 描述:Xilinx虚拟电缆(XVC)是基于TCP / IP的协议,其行为类似于JTAG电缆,并提供了一种无需使用物理电缆即可访问和调试FPGA或SoC设计的方法。 此功能有助于简化以下设计的硬件调试: 将FPGA放在难以接近的位置,而“ lab-PC”不在附近 不能直接访问FPGA引脚-例如,只能通过本地处理器接口访问JTAG引脚 需要有效地调试现场部署的Xilinx FGPA或SoC系统,以节省昂贵或不切实际的旅行,并减少调试远程系统所需的时间。 主要特点和优势 能够通过内部网络甚至Internet调试系统。 通过Vivado Logic Analyzer IDE进行调试,就像通过标准JTAG或并行电缆直接连接到设计一样 XAPP1251中提供了带有应用笔记和参考设计的Zynq:registered:-7000演示-使用PetaLinux工具在Zynq-7000上运行的Xilinx

使用USB转JTAG芯片CH347在Vivado下调试

Vivado下使用CH347进行JTAG调试下载,源码开放,一起探索~

OIDCAT的博客 6996

xvc(Xilinx Virtual Cable)实现

讲述了如何搭建vivado工程,以及通过petalinux生成SD卡启动文件。

vivado XVC 服务器实现

vivado XVC 服务器实现

cckkppll的博客 2405

基于ZYNQ的XVC(Xilinx Virtual Cable)实现TCP-JTAG调试经验.pdf

基于ZYNQ045芯片的XVC功能的实现,实现了TCP-JTAG的功能。文档主要分为VIVADO工程的搭建、uboot移植、XVC驱动程序移植、XVC应用程序移植和测试验证等部分组成。在zynq045的板卡上通过网络-JTAG成功连接板载的XC7V690T的芯片。亲测可用,实际调试经验。

ch347-vivado-download-script.zip

CH347配合Vivado下载程序运行脚本,使用详情见: CH347 USB转JTAG功能使用笔记:CH347配合Vivado进行FPGA程序下载插件:https://blog.csdn.net/qq_43010294/article/details/15503493

在 Vivado 中执行远程调试

在 Vivado 中执行远程调试

cckkppll的博客 2581

FOC项目知识点总结三 | 完全搞懂 Clarke 与 Park 变换(附动图,仿真文件以及详细讲解数学推导过程)

本文目的,最终可以完整推算两种变换 Clarke 变换 首先先看我们需要用到的两种坐标系 1. 自然坐标系 abcabcabc 我们知道,通过三相逆变电路,我们可以画出一个自然坐标系 abcabcabc ,即三相电压的坐标系,通入的电流在这三轴坐标系中变化: 将三个矢量相加合并在一起就如下图所展现: 使用三个坐标轴来表示十分的麻烦与不直观,因为其是非正交的,于是乎我们想要将其转化成使用两个正交的坐标轴来表示,于是乎便有了 Clarke变换。 Clarke 变换的作用: 将基于三轴二维的定子静止坐标系的各

Wilson Huang的博客 3万+

HDU1038——Biker‘s Trip Odometer,HDU1039——Easier Done Than Said?,HDU1040——As Easy As A+B

目录HDU1038——Biker's Trip Odometer题目描述运行代码代码思路HDU1039——Easier Done Than Said?题目描述运行代码代码思路HDU1040——As Easy As A+B题目描述运行代码(冒泡排序)代码思路运行代码(快速排序)代码思路Problem - 1038 代码思路 初始化:无限循环:计算行驶距离:计算平均速度:输出结果:输出格式化的字符串,显示旅行编号、行驶距离和平均速度。使用 和 控制输出的格式,确保小数点后两位的精度。更新计数器:每

u014114223的博客 1712

西门子S7-1200/1500 PLC编程与应用技巧

西门子S7-1200 PLC是一款紧凑型的控制器,适用于小型到中型的自动化控制任务。紧凑设计:集成了I/O模块,减少了控制柜的空间需求。高性能:高达25µs的扫描时间,能够快速响应。模块化扩展:支持扩展输入输出模块、通信模块和智能模块,满足不同的应用需求。多种编程语言:支持Ladder图(梯形图)、功能块图(FBD)、结构化文本(ST)等多种编程语言。西门子S7-1200与S7-1500 PLC是强大且灵活的工业控制系统,适用于各种自动化应用。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 2690

【新手必看】挖漏洞流程指南,黑客手把手教你挖漏洞月入过万!收藏这篇就够了!(附学习笔记)

【新手必看】挖漏洞流程指南,黑客手把手教你挖漏洞月入过万!收藏这篇就够了!(附学习笔记)【新手必看】挖漏洞流程指南,黑客手把手教你挖漏洞月入过万!收藏这篇就够了!(附学习笔记)

weixin_57514792的博客 1110

HDU(简单题目) 1038 Biker's Trip Odometer 1039 Easier Done Than Said?

心情不好,找了几个水题 1038 Biker's Trip Odometer  题意难懂,直径  圈数  时间,算总的路程,然而车走的是步数,要化成mile /* HDU 1038 题意:直径 圈数 时间 思路:算出总路程,然而这个路程是步数,要换算成mile */ #include #include using namespace std; const double p

huatian5的博客 537

MacBook Pro 合盖省电终极配置:pmset 5条命令实现一夜掉电<1%

本文详细介绍了如何通过5条pmset终端命令优化MacBook Pro的合盖休眠设置,实现一夜掉电<1%的极致省电效果。针对M系列芯片的特性,文章解析了MacOS的休眠机制,并提供电池模式与电源模式的差异化配置方案,帮助用户显著提升续航表现。

weixin_33824385的博客 484

hdoj 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): 8336    Accepted Submission(s): 4091 Problem Description Pas

走一步再走一步 536

Dify工作流自动化:如何用Trae AI助手10倍提升你的开发效率(含避坑指南)

本文详细介绍了如何利用Trae AI助手自动化生成Dify工作流,实现开发效率的10倍提升。通过构建DSL示例库、精准需求描述和四步实战法,开发者可将重复的配置工作交给AI,快速生成可运行的工作流,并提供了关键的避坑指南。

weixin_29062865的博客 374

从开发到生产:Power APP 的应用和编程实践

一旦您在开发环境中完成了应用程序的开发、调试和测试,就可以将其部署到生产环境中供用户使用。在 Power APP Studio 中,您可以选择将应用程序发布到 Power APP 网关或将其嵌入到其他应用程序中。使用 Power APP Studio 内置的调试工具,您可以逐步执行应用程序并查看变量的值,以确保逻辑的正确性。在上述代码中,我们通过将两个文本输入框(TextInput1 和 TextInput2)中的文本转换为数字,并将它们相加,将结果存储在 Result 变量中。

2301_79326510的博客 1508

杭电1039 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): 10540    Accepted Submission(s): 5090 Problem Description Pa

hpuzsk的博客 569

Python爬虫教程:抓取纽约时报文章存档

爬虫技术主要用于从网站上抓取并提取数据。HTTP请求:使用requests库发送HTTP请求以获取网页。网页解析:使用或lxml库解析HTML网页。数据存储:将抓取的数据保存为CSV、JSON等格式,或者存储在数据库中。防反爬虫技术:模拟正常的用户请求,避免被反爬虫机制封锁。多线程与异步爬取:提高抓取效率。通过这篇博客,您已经学习了如何使用Python爬取纽约时报的历史文章存档。本文介绍了如何模拟请求头、抓取网页内容、解析HTML并提取数据,最后存储到CSV文件或数据库中。

2201_76125261的博客 598

E - Easier Done Than Said?

E - Easier Done Than Said? 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 com...

Lionel的博客 251

鱼鹰优化算法(OOA)详解:从猛禽捕食智能到优化算法实现

鱼鹰优化算法(Osprey Optimization Algorithm, OOA)是2023年提出的一种新型元启发式优化算法,灵感来源于鱼鹰(一种中型猛禽)高效的捕食策略。算法模拟了鱼鹰从空中识别水下鱼类位置并俯冲捕食,然后将捕获的鱼带至安全位置享用的全过程,以此抽象出全局探索和局部开发两个核心阶段。OOA算法具有参数少、结构简单、收敛速度快、全局寻优能力强等特点。自提出以来,已在函数优化、机器学习参数调优(如CatBoost模型)、路径规划等多个领域展现出良好性能,为解决复杂优化问题提供了新的有效工具。

qq_42212808的博客 278

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

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 Pas

My Castle 1033

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

上一篇: A+B Coming
下一篇: A hard puzzle
Liusuzhi19610221
博客等级 码龄12年 2粉丝 127原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值