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

终于AC拉。。。

Posted by long2006 at 2008-07-28 20:07:48 on Problem 1126
晕啊。。。偶终于AC拉。。。
#include "stdio.h"
#include "string.h"

char a[400];
int flag;
int len;
int i,j;
int main()
{		
	while((scanf("%s",&a))!=EOF)
	{	
		flag=0;
		//scanf("%s",&a);	
		len=(int)strlen(a);
		for(i=len-1;i>=0;i--)
		{
			if(a[i]>='p'&&a[i]<='z')
			{
				flag++;
			}
			else if(a[i]=='C'||a[i]=='D'||a[i]=='E'||a[i]=='I')
			{
				if(flag>=2)
				{
					flag--;
				}
				else 
				{
					flag=0;
					break;
				}
			}
			else if(a[i]=='N')
			{
				if(flag==0)
				{
					break;
				}
			}
			else
			{
				flag=0;
				break;
			}
		}
		if(flag==1)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		for(j=0;j<len;j++)
		{
			a[j]='\0';
		}
	}
		return 0;
}

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