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

Code

Posted by 330104200811185031 at 2022-05-22 19:12:30 on Problem 1833
#include<iostream>
#define Max 10
using namespace std;

int res[8100],t[8100],num;

void solve(int n)
{

	/*
	for(int i=2;i<=Max;i++)
	{
		res[i-1] = n%i;
		n /= i;
	}
	*/
	for(int j=1;j<=n;j++)
	{
		for(int i=n-1;i>=0;i--)
		{
			if(res[i]==0)
			{
				t[i] = j;
				res[i]--;
				break;
			}
			else if(res[i]>0)
			{
				res[i]--;
			}
		}
	}
}
int main()
{
	res[0] = 0;
	cin>>num;
	for(int i=1;i<num;i++)
	{
		cin>>res[i];
	}
	solve(num);
	for(int i=0;i<num;i++)
	{
		cout<<t[i]<<endl;
	}
}

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