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:那个程序有一个不太明显的错误

Posted by forandomtest at 2009-02-24 16:53:54 on Problem 1042
In Reply To:那个程序有一个不太明显的错误 Posted by:number at 2006-03-23 00:14:30
                        left_time = h*60-t[k]*5;//////
			for(i=1;i<=n;i++)
			{
				ff[i] = f[i];
				tt[i] = 0;
			}
			while(left_time > 0)
			{
				j = 1;
				for(i=1;i<=k;i++)
				{
					if(ff[i] > ff[j])
						j = i;
				}
				if(ff[j] == 0)////鱼都没了;
					break;
				tt[j] += 5;
				fish += ff[j];
				ff[j] -= d[j];
				if(ff[j] <=0)
					ff[j] = 0;
				left_time -= 5;
			}
			//left_time>=0;
			tt[1] += left_time;

____________________________________________________________________

left_time = h*60-t[k]*5;
这条语句有可能把left_time整成负数。


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