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 bobten2008 at 2009-11-28 21:01:14 on Problem 1907
假设当前要处理的工作量是CurWork,当前的花费是total那么贪心策略的选取是:
比较B和(CurWork - int(CurWork / 2))×A的大小,哪个小就将total加上哪个
然后CurWork = int(CurWork / 2)
!注意当(CurWork / 2) < M时只能采用一个一个取的策略,否则如果采取取半的策略,
得到的剩余工作量将小于M,不符合题意

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