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 LKRICH7 at 2004-09-21 11:28:47 on Problem 1126
#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:
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