zoukankan      html  css  js  c++  java
  • hdu1039

    #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. ",str);
    continue;
    }
    if(judge2(len)==false)
    {
    printf("<%s> is not acceptable. ",str);
    continue;
    }
    if(judge3(len)==false)
    {
    printf("<%s> is not acceptable. ",str);
    continue;
    }
    printf("<%s> is acceptable. ",str);
    }
    return 0;
    }

  • 相关阅读:
    Linux基礎命令
    Linux_文件系統結構
    Linux_目錄結構與操作_基本命令
    JS简单打字小游戏demo
    开发板通过路由器访问外网
    VIM基本操作命令表
    破解source insight4.0
    进程控制
    静态库与动态库的制作和使用
    STM32建工程模板
  • 原文地址:https://www.cnblogs.com/wangkun1993/p/6286414.html
Copyright © 2011-2022 走看看