Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
附代码,求牛人解释为什么过不了?#include "stdio.h" #include "string.h" int main() { unsigned int i; int flag=0,a=0,b=0,flag1=0,length; char q[20],t[4]="end",p[5]={'a','e','i','o','u'}; while(gets(q)) { if(strcmp(q,t)==0) break; length=strlen(q); if(length==1) { if(q[0]=='a'||q[0]=='e'||q[0]=='i'||q[0]=='o'||q[0]=='u') printf("<%s> is acceptable.\n",q); else printf("<%s> is not acceptable.\n",q); flag1=1; } else { for(i=0;i<=length-1;i++) { if(q[i]=='a'||q[i]=='e'||q[i]=='i'||q[i]=='o'||q[i]=='u') { flag=1;//1 a++; b=0; if(a==3) { printf("<%s> is not acceptable.\n",q);flag1=1;break;} } else { b++; a=0; if(b==3) { printf("<%s> is not acceptable.\n",q);flag1=1;break;} } if(i!=length-1) { if(q[i]==q[i+1]&&q[i]!='e'&&q[i]!='o')//3 { printf("<%s> is not acceptable.\n",q);flag1=1;break;} } } } if(flag1==0) if(flag==1) printf("<%s> is acceptable.\n",q); else printf("<%s> is not acceptable.\n",q); a=0; b=0; flag=0; flag1=0; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator