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 |
Re:再问这题的贪心算法In Reply To:Re:再问这题的贪心算法 Posted by:nestle at 2005-05-26 22:33:48 先排序,得到两个队列,分别表示田忌和齐王的马. 设lost = 0; 从大到小逐对比较,如果有一对中田忌的马比齐王的马慢,则至少输一次.lost++.然后把田忌的马中跑得最慢的和齐王的马中最快的去掉,再逐对比较,重复上述过程直到田忌能够不败.最后得到的lost值就是最少输的次数. > 觉得你的思路和我的不太一样 是不是从一开始就算出最少输多少次?然后枚举?还有 请问怎么算至少输多少次? 谢谢 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator