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 myjfm at 2009-07-24 20:21:17 on Problem 2287
1)将田忌的马按照速度从小到大排序
     将king的马按照速度从大到小排序
2)对田忌的每个马(从小到大扫描),依次和king的每个马(从大到小扫描)比较:
1:如果能赢,那当然就赢了(因为这是田忌还未参加比赛的最差的马)
2:如果能平,就尽量平(原因同上)
3:前两条扫描完后所有的马都赢不了了,只能全输了。
这样写,代码也相当简单。这是第一感觉,一次AC,后来又想别贪心方法,都WA,郁闷啊。

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