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 ASCII at 2007-05-15 14:46:49 on Problem 3231
In Reply To:Why TLE ? Help ! Posted by:ASCII at 2007-05-12 21:02:15
                  rest=t;
		for (i=1;i<=m;i++) 
		    rest-=a[i].curr;
		for (i=1;i<=m;i++)
		    a[i].dis=a[i].max-a[i].curr;
		qsort(&a[1],m,sizeof(a[1]),cmp);
		for (i=1;i<=m;i++)
		{
			ave=rest/(m+1-i);
			if (ave>=a[i].dis)
			{
				a[i].curr=a[i].max;
				rest-=a[i].dis;
			}
			else
			{
				a[i].curr+=ave;
				rest-=ave;
			}
		}
为什么是wrong answer 呢?

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