HDU 1052 田忌赛马 (贪心_好题)

贪心策略.
很容易被题目意思误导过去用最大权值匹配。
一、如果a的最慢速度大于b的最慢,则直接a的最慢与b的最慢比赛,赢一场;
二、如果a的最慢速度小于b的最慢,则用a的最慢浪费b的最快,输一场;
三、如果a的最慢速度等于b的最慢,则:
1.如果a的最快速度大于b的最快,则直接a的最快与b的最快进行比赛,赢一场;
2.如果b的最快速度小于b的最快,则用a的最慢浪费b的最快,输一场;
3.如果a的最快速度等于b的最快,即a与b的最慢与最快分别相等,则:
a.如果a的最慢速度小于b的最快,则用a的最慢浪费b的最快,输一场;
b.如果a的最慢速度等于b的最快,即a的最慢、a的最快、b的最慢、b的最快相等,
说明剩余未比赛的马速度全部相等,直接结束比赛。
 
贪心策略也容易理解。但是证明比较麻烦,不去理解了。



Problem Description
Here is a famous story in Chinese history.

"That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others."

"Both of Tian and the king have three horses in different classes, namely, regular, plus, and super. The rule is to have three rounds in a match; each of the horses must be used in one round. The winner of a single round takes two hundred silver dollars from the loser."

"Being the most powerful man in the country, the king has so nice horses that in each class his horse is better than Tian's. As a result, each time the king takes six hundred silver dollars from Tian."

"Tian Ji was not happy about that, until he met Sun Bin, one of the most famous generals in Chinese history. Using a little trick due to Sun, Tian J
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值