Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我来说一下比较清晰的贪心策略假设当前要处理的工作量是CurWork,当前的花费是total那么贪心策略的选取是: 比较B和(CurWork - int(CurWork / 2))×A的大小,哪个小就将total加上哪个 然后CurWork = int(CurWork / 2) !注意当(CurWork / 2) < M时只能采用一个一个取的策略,否则如果采取取半的策略, 得到的剩余工作量将小于M,不符合题意 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator