Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

水好深啊!

Posted by chenxuan123456789 at 2012-10-25 22:02:50 on Problem 1575
#include <stdio.h>
#include <string.h>

int main()
{
    char str[100];
    int index,length,i,j,count,flag;
    while(scanf("%s",str)!=EOF)
    {
                               if(strcmp(str,"end")==0)
                               break;
                               count=0;
                               flag=0;
                               length=strlen(str);
                               for(index=0;index<length;index++)
                               if(str[index]=='a'||str[index]=='e'||str[index]=='i'||str[index]=='o'||str[index]=='u')
                               count++;
                               if(count<1)
                               {
                                          printf("<%s> is not acceptable.\n",str);
                                          continue;
                               }
                               for(index=0;index<length-2;index++)
                               if(
							   (
							   (str[index]=='a'||str[index]=='e'||str[index]=='i'||str[index]=='o'||str[index]=='u')&&
                               (str[index+1]=='a'||str[index+1]=='e'||str[index+1]=='i'||str[index+1]=='o'||str[index+1]=='u')&&
                               (str[index+2]=='a'||str[index+2]=='e'||str[index+2]=='i'||str[index+2]=='o'||str[index+2]=='u')
							   )
							   ||
                               (
							   (str[index]!='a'&&str[index]!='e'&&str[index]!='i'&&str[index]!='o'&&str[index]!='u')&&
                               (str[index+1]!='a'&&str[index+1]!='e'&&str[index+1]!='i'&&str[index+1]!='o'&&str[index+1]!='u')&&
                               (str[index+2]!='a'&&str[index+2]!='e'&&str[index+2]!='i'&&str[index+2]!='o'&&str[index+2]!='u')
							   )
							   )
                               flag=1;
                               if(flag)
                               {
                                       printf("<%s> is not acceptable.\n",str);
                                       continue;
                               }
                               flag=0;
                               for(index=0;index<length-1;index++)
                               if(str[index]==str[index+1]&&str[index]!='o'&&str[index]!='e')
                               flag=1;
                               if(flag)
                               {
                                       printf("<%s> is not acceptable.\n",str);
                                       continue;
                               }
                               printf("<%s> is acceptable.\n",str);
	}          
    return 1;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator