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 woa at 2020-03-15 18:20:59 on Problem 3253
In Reply To:关于这个题,小妹有一个问题求教 Posted by:YT201756501121 at 2020-02-13 15:04:07
> 小妹不才,问的问题对于巨巨们来说可能太简单:
> 为什么这个贪心的思路不能是每次减去最大长度的木块?
> 举个例子:
> ans=0 //记录结果,花费代价
> ans+= 21    21-8=13
> ans+=13     13-8=5
> 然后结果就是34了。。。
> 一直不明白为什么不能这样做。
> 谢谢啦。

看这组数据:
3
10 10 10 10

按照每次减去最大的话,结果是:40 + 30 + 20 = 90

但是实际上,是先把长度为 40 的木板,分成两个 20 的,最后的结果是 40 + 20 + 20 = 80


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