前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布

hdu1039

作者头像
@坤的
发布2018-06-04 11:05:48
4970
发布2018-06-04 11:05:48
举报
文章被收录于专栏:*坤的Blog*坤的Blog

#include<stdio.h> #include<string.h> const int MAXN=200; char str[MAXN];

bool isvowel(char c) { if(c=='a'||c=='e'||c=='i'||c=='u'||c=='o') return true; else return false; } bool judge1(int n) //至少要有一个元音字母 { for(int i=0;i<n;i++) { if(isvowel(str[i])) return true; } return false; } bool judge2(int n) { for(int i=2;i<n;i++) { if(isvowel(str[i-2])&&isvowel(str[i-1])&&isvowel(str[i])) return false; if(!isvowel(str[i-2])&&!isvowel(str[i-1])&&!isvowel(str[i])) return false; } return true; } bool judge3(int n) { for(int i=1;i<n;i++) { if(str[i]==str[i-1]&&str[i]!='e'&&str[i]!='o') return false; } return true; } int main() { int len; while(scanf("%s",&str)!=EOF) { if(strcmp(str,"end")==0) break; len=strlen(str); if(judge1(len)==false) { printf("<%s> is not acceptable.\n",str); continue; } if(judge2(len)==false) { printf("<%s> is not acceptable.\n",str); continue; } if(judge3(len)==false) { printf("<%s> is not acceptable.\n",str); continue; } printf("<%s> is acceptable.\n",str); } return 0; }

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017-01-14 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档