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 |
建议别用getchar之类的输入函数In Reply To:大家帮忙看看如果用注释里的输入有什么问题?就是过不了 Posted by:LKRICH7 at 2004-09-21 11:28:47 > #include<stdio.h> > #define MAXLEN 256 > int main() > { > char s[MAXLEN]; > int i,flag; > while(scanf("%s",s)==1/* 1*/) > { > for(i=0;s[i]!=0;i++); > /* ********************* > for(i=0;(s[i]=getchar())!='\n';i++) > if(s[i]==EOF) return(0); > ********************** */ > flag=0; > for(i--;i>=0;i--) > { > if(s[i]>='p'&&s[i]<='z'){++flag;continue;} > if(s[i]=='N') > {if(flag>=1)continue;else break;} > if(s[i]=='C'||s[i]=='D'||s[i]=='E'||s[i]=='I') > {if(flag>=2)--flag;else {flag=0;break;}} > else{flag=0; break;} > } > if(flag==1)printf("YES\n");else printf("NO\n"); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator