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

垃圾题目 做对了还说wa 非要第一种输出才对 第二种就不对

Posted by yanzhengfei at 2009-08-06 08:52:13 on Problem 1068
#include"iostream"
using namespace std;
int flag[100],c[100];
int main()
{
	int t,i,j,n,m;
	scanf("%d",&t);
	while(t--)
	{
		for(int i=1;i<100;i++)
		{
		   flag[i]=1;
	       c[i]=-1;
		}
		scanf("%d",&n);
		for(j=1;j<=n;j++)
		{
			scanf("%d",&m);
            for(i=m;i>=1;i--)
				if(flag[i])
				{
					flag[i]=0;
					c[j]=m-i+1;
					break;
				}
			printf("%d ",c[j]);
		}
		printf("\n");
	}
}

**********************************************************
#include"iostream"
using namespace std;
int flag[100],c[100];
int main()
{
	int t,i,j,n,m;
	scanf("%d",&t);
	while(t--)
	{
		for(int i=1;i<100;i++)
		{
		   flag[i]=1;
	          c[i]=-1;
		}
		scanf("%d",&n);
		for(j=1;j<=n;j++)
		{
		     scanf("%d",&m);
                      for(i=m;i>=1;i--)
				if(flag[i])
				{
					flag[i]=0;
					c[j]=m-i+1;
					break;
				}
		}
              for(i=1;i<n;i++)
                   printf("%d ",c[i]);
                   printf("%d\n",c[i]);
	}
}

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