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

why I Presentation Error(with the source)

Posted by windbells at 2004-07-07 18:47:17 on Problem 1068
#include<stdio.h>
int main()
{
	int arry[60],t,n,i,a[30],k,j;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		a[0]=0;k=0;
		for(i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			for(j=k+1;j<=k+a[i]-a[i-1];j++)
				arry[j]=1;
			k=j;
			arry[k]=0;
		}
		for(i=1;i<=n;i++)
			a[i]=0;
		k=0;
		for(i=1;i<=2*n;i++)
		{
			if(arry[i]==1)
			{
				k++;
				for(j=1;j<=k;j++)
					a[j]++;
			}
			else if(arry[i]==0)
			{
				if(k==1)
					printf("%d\n",a[k]);
				else
					printf("%d ",a[k]);
				a[k]=0;
				k--;
			}
		}
	}
}

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