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 hujialie at 2003-05-31 22:54:40 on Problem 1126
#include "stdio.h"
int sentence;
char sen[300];

int main()
{
	int i;
	while(scanf("%s",sen)==1)
	{
		sentence=0;
		for(i=0;sen[i]!=0;i++);
		for(i--;i>=0;i--)
		{
			if(sen[i]=='C'||sen[i]=='D'||sen[i]=='E'||sen[i]=='I')
			{
				if(sentence>=2)sentence--;
				else
				{
					sentence=0;
					break;
				}
			}
			else
			{
				if(sen[i]=='N')
				{
					if(sentence>=1)continue;
					else break;
				}
				else
				{
					if(sen[i]>='p'&&sen[i]<='z')
					{
						sentence++;
						continue;
					}
					else
					{
						sentence=0;
						break;
					}
				}
			}
		}
		if(sentence==1)printf("YES\n");
		else printf("NO\n");
	}
	printf("%c",-1);
	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