Description
Farmer John went to cut some wood and left
Each cow
Write a program to determine the order in which FJ should pick up the cows so that the total number of flowers destroyed is minimized.
Input
Lines 2..
Output
Sample Input
6 3 1 2 5 2 3 3 2 4 1 1 6
Sample Output
86
Hint
每头牛对应需要赶回的时间和吃草速度,求吃最少的草。
一个贪心的题,按速度除以时间排序;证明:取两头牛,其他的牛吃的草就可以看成常量,若先赶a牛,吃的草是2*t[a]*d[b],若是b牛,就是2*t[b]*d[a],就是比较这两个的大小。这样看就是一个水题了。
#include
#include
using namespace std;
struct Cow{
}cow[100005];
bool cmp(const Cow &a, const Cow &b)
{
}
int main()
{
}