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

Re:Notice~恶心模拟题~

Posted by like680623 at 2011-02-01 20:02:42 on Problem 1068
#include<iostream>
using namespace std;

int main()
{
	int tot, n, x, k, value[25], num[25];
	cin>>tot;
	while (tot--)
	{
		cin>>n;
		memset(value, 0, sizeof(value));
		memset(num, 0, sizeof(num));
		for (int i = 1; i <= n; i++)
		{
			cin>>value[i];
			k = 0;
			num[i] = value[i] - value[i - 1];
			for (int j = i; j > 0; j--)
			{
				if (num[j] != 0)
				{
					printf("%d ", ++k);
					num[j]--;
					break;
				}
				k++;
			}
		}
		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