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:为什么,总是wa啊,大牛门帮看看啊T_T``另外时间越界是什么意思啊?

Posted by cangratul at 2007-02-05 17:17:12 on Problem 3104
In Reply To:为什么,总是wa啊,大牛门帮看看啊T_T``另外时间越界是什么意思啊? Posted by:cangratul at 2007-02-05 09:08:20
	if(k!=1)
	{
		k--;
		while(min<=max)
		{
			sum=0;
			mid=(max+min)>>1;
			for(i=0;i<n;i++)
			{
				if(a[i]>mid)
				{
					sum+=(a[i]-mid-1)/k+1;
					if(sum>mid)
					{
						min=mid+1;
						goto next;
					}
				}
			}
			max=mid-1;
			next:;
		}
		max++;
	}
}原来时间超界是指sum可能超int,还有MS不需要while循环,wa了N次,最后还是同学提醒才知道``,希望不要被上面的帖子误导了555~~~

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