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 1272406003 at 2009-04-19 10:17:52 on Problem 1068 and last updated at 2009-04-19 10:18:16
#include <iostream>
using namespace std;
int main()
{
	int i,j,t,n;
	int g_left_sum[21],left_sum[21],result_sum[21];
	left_sum[0]=0;g_left_sum[0]=1;
	cin>>t;
	while (t--)
	{
		cin>>n;
		for (i=1;i<=n;i++)
		{
			cin>>left_sum[i];
			g_left_sum[i]=left_sum[i]-left_sum[i-1];
		}
		for (i=1;i<=n;i++)
		{
			for (j=i;j>=0;j--) 
			{
				if(.......)//版权问题,此处被省略~
				{
					g_left_sum[j]--;
					result_sum[i]=i-j+1;
					break;
				}
			}
		}
		cout<<result_sum[1];
		for (i=2;i<=n;i++)
			cout<<" "<<result_sum[i];
		cout<<endl;
	}
	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