| ||||||||||
| 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 | |||||||||
Re:高手来看看 到底哪不对啊 测试数据都对 总是WAIn Reply To:高手来看看 到底哪不对啊 测试数据都对 总是WA Posted by:huanyinghj at 2010-09-02 11:08:52 > #include <stdio.h>
> #include <string.h>
> int main()
> {
> char str[21];
> int len,j,t,k,c1,c2,c3;
> char a='a',e='e',i='i',o='o',u='u',end[]={"end"};
> while(1)
> {
> t=k=c1=0;
> c2=c3=1;
> scanf("%s",str);
> if(strcmp(str,end)==0) break;
> len=strlen(str);
> if(len>20) continue;
> for(j=0;j<len;j++)
> {
> if(str[j]==a || str[j]==e || str[j]==i || str[j]==o || str[j]==u)
> {
> c1=1;
> t++;
> k=0;
> if(t==3) {c1=0;break;}
> }
> else
> {
> t=0;
> k++;
> if(k==3) {c2=0;break;}
> }
> }
> for(j=1;j<len;j++)
> { if(str[j]==str[j-1] && str[j]!=e && str[j]!=o)
> {
> c3=0;
> break;
> }
> }
> if(c1==0 || c2==0 || c3==0)
> printf("<%s> is not acceptable.\n",str);
> else
> printf("<%s> is acceptable\n",str);
> }
> return 0;
> }
第二个acceptable少一个点,加了就ac了~~
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator