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 qianling at 2010-06-20 11:13:06 on Problem 1068
#include "stdio.h"

using namespace std;

int main(int argc, char* argv[])
{
	int t,n;
	int p;
	scanf("%d",&t);

	while (t)
	{
		--t;
		int s[21];
		int top(0);

		scanf("%d",&n);
		int leftCount(0);
		for (int i=0;i<n;++i)
		{
			scanf("%d",&p);
			for (int j=0;j<p-leftCount;++j)
			{
				s[top] = 1;
				++top;
			}
			leftCount = p;
			int topNum = s[top-1];
			printf("%d ",topNum);
			--top;

			for (int j=0;j<top;++j)
			{
				s[j] += 1;
			}

		}
		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