HDU 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): 16543 Accepted Submission(s): 7846
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.
tv
ptoui
bontres
zoggax
wiinq
eep
houctuh
end
<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 main(){
char a[];
int i,num,flag,len;
int b[];
while(~scanf("%s",&a)&&strcmp("end",a)){
for(i=;i<;i++)
b[i]=;
num=;
flag=;
len=strlen(a);
for(i=;i<len;i++){
if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'){
b[i]=;
num+=;
}
else
b[i]=;
}
for(i=;i<len;i++){
if(b[i]==b[i-]&&b[i-]==b[i-]){
flag=;
break;
}
}
for(i=;i<len;i++){
if(a[i]==a[i-]&&a[i]!='e'&&a[i]!='o'){
flag=;
break;
}
}
if(num==||flag==)
printf("<%s> is not acceptable.\n",a);
else
printf("<%s> is acceptable.\n",a);
}
return ;
}
HDU 1039.Easier Done Than Said?-条件判断字符串的更多相关文章
- 题解报告:hdu 1039 Easier Done Than Said?
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1039 Problem Description Password security is a trick ...
- hdu 1039 Easier Done Than Said? 字符串
Easier Done Than Said? Time Limi ...
- HDU 1039.Easier Done Than Said?【字符串处理】【8月24】
Easier Done Than Said? Problem Description Password security is a tricky thing. Users prefer simple ...
- HDOJ/HDU 1039 Easier Done Than Said?(字符串处理~)
Problem Description Password security is a tricky thing. Users prefer simple passwords that are easy ...
- HDU 1039 -Easier Done Than Said?
水水的 #include <iostream> #include <cstring> using namespace std; ]; bool flag; int vol,v2 ...
- jstl if条件判断字符串代码
<c:if test="${netWorkInfo.networkType eq '快修店'}"> <input type="radio" n ...
- C# if中连续几个条件判断
C# if中连续几个条件判断 1.if (条件表达式1 && 条件表达式2) 当条件表达式1为true时 using System; using System.Collections. ...
- js条件判断时隐式类型转换
Javascript 中,数字 0 为假,非0 均为真 在条件判断运算 == 中的转换规则是这样的: 如果比较的两者中有布尔值(Boolean),会把 Boolean 先转换为对应的 Number,即 ...
- 5-3 bash脚本编程之二 条件判断
1. 条件测试的表达式 1. [ expression ] :注意这个中括号的前后都有一个空格 2. [[ expression ]] 3. test expression 2.条件判断的类型 1. ...
随机推荐
- [洛谷P3377]【模板】左偏树(可并堆)
题目大意:有$n$个数,$m$个操作: $1\;x\;y:$把第$x$个数和第$y$个数所在的小根堆合并 $2\;x:$输出第$x$个数所在的堆的最小值 题解:左偏树,保证每个的左儿子的距离大于右儿子 ...
- HDU.2095(异或运算)
find your present (2) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- Angular Cookie 读写
var app = angular.module('Mywind',['ui.router']) app.controller('Myautumn',function($scope,$http,$fi ...
- Educational Codeforces Round 59 (Rated for Div. 2) DE题解
Educational Codeforces Round 59 (Rated for Div. 2) D. Compression 题目链接:https://codeforces.com/contes ...
- bzoj 2525 [Poi2011]Dynamite 二分+树形dp
[Poi2011]Dynamite Time Limit: 30 Sec Memory Limit: 128 MBSubmit: 270 Solved: 138[Submit][Status][D ...
- win7---虚拟wifi无法启动承载网络
转载自:http://nbbbs.zol.com.cn/40/32108_397955.html 解决方案:控制面板→硬件和声音→电源选项→更改计划设置→更改高级电源设置→无线适配器设置→节能模式,改 ...
- 解读dbcp自动重连那些事
转载自:http://agapple.iteye.com/blog/791943 可以后另一篇做对比:http://agapple.iteye.com/blog/772507 同样的内容,不同的描述方 ...
- 如何解决DuplicateFileException: Duplicate files copied in APK问题
问题:有重复的文件存在APK里 解决方案:在Module里的build.gradle中设置忽略此重复文件即可.
- 【洛谷 P2485】 [SDOI2011]计算器 (BSGS)
题目链接 第一问:快速幂 第二问:扩欧解线性同余方程 第三问:\(BSGS\) 三个模板 #include <cstdio> #include <cmath> #include ...
- 卡片选项页面 JTabbedPane 的使用
package first; import javax.swing.*; import java.awt.*; import java.awt.event.*; class TtpDemo exten ...