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

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