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

为什么Output Limit Exceeded呢...附代码

Posted by gaogaommu at 2010-08-11 15:31:44 on Problem 1363
#include<stdio.h>
#include<string.h>

int main()
{
	int i,n,tag,flag,stack[1000];

	while(scanf("%d",&n)!=EOF&&n!=0)
	{
		while(scanf("%d",&stack[0]),stack[0]!=0)
		{
			memset(stack+1,0,sizeof(stack));
			for(i=1;i<n;i++)
				scanf("%d",&stack[i]);

			tag=0,flag=0;
			while(1)
			{
				for(i=tag;stack[i]<=stack[tag]&&i<n;i++)
				{
					if(stack[i]>stack[i-1]&&stack[i]<stack[tag])
					{
						flag=1;
						break;
					}
				}
				if(flag==1)
					break;
				if(i==n)
					break;
				tag=i;
			}
			if(flag==1)
				printf("No\n");
			else
				printf("Yes\n");
		}
		printf("\n");
	}
	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