hdu1052 贪心
题意:两个人tian和king赛马,每匹马的品种不同,每匹马依次出战(顺序任意),每次比赛输了的人要给赢的人200dollars,问tian最多能得到多少钱……(题目很长,看了半天)
/
我的解法:其实题目中说的很明白,用最弱的和king中最强的比赛,是tian的胜算加大。
当tian.max > king.max 就选他们进行比赛(当前状况的最佳解)
else tian.min > king.min 就选他们进行比赛(当前状况的最佳解)
else tian.min去和king.max进行比赛(若没有赢的胜算,就用最差的去消耗对手最强的)
///
代码如下
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
<