poj3262 Protecting the Flowers】的更多相关文章

Protecting the Flowers Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4418   Accepted: 1785 Description Farmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as usual. When he returned, he found to his ho…
思路: 简单贪心,每次选择性价比最高的. 实现: #include <iostream> #include <cstdio> #include <algorithm> using namespace std; struct node { int t, d; }; int n; node a[]; ]; bool cmp(const node & a, const node & b) { double x = a.d * 1.0 / a.t; double…
Protecting the Flowers 直接中文 Descriptions FJ去砍树,然后和平时一样留了 N (2 ≤ N ≤ 100,000)头牛吃草.当他回来的时候,他发现奶牛们正在津津有味地吃着FJ种的美丽的花!为了减少后续伤害,FJ决定立即采取行动:运输每头牛回到自己的牛棚. 每只奶牛i在离牛棚Ti(1 ≤ Ti ≤ 2,000,000) 分钟路程的地方,每分钟吃掉Di(1 ≤ Di ≤ 100)朵花.FJ使尽浑身解数,也只能一次带回一头奶牛.弄回一头奶牛i需要2*Ti分钟(来回…
http://poj.org/problem?id=3262 Protecting the Flowers Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4930   Accepted: 1965 Description Farmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as usual. When…
1634: [Usaco2007 Jan]Protecting the Flowers 护花 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 448  Solved: 276[Submit][Status] Description Farmer John went to cut some wood and left N (2 <= N <= 100,000) cows eating the grass, as usual. When he retur…
考虑相邻的两头奶牛 a , b , 我们发现它们顺序交换并不会影响到其他的 , 所以我们可以直接按照这个进行排序 --------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<iostream>   #define rep( i ,…
1634: [Usaco2007 Jan]Protecting the Flowers 护花 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 493  Solved: 310[Submit][Status] Description Farmer John went to cut some wood and left N (2 <= N <= 100,000) cows eating the grass, as usual. When he retur…
P2878 [USACO07JAN]保护花朵Protecting the Flowers 难得的信息课......来一题水题吧. 经典贪心题 我们发现,交换两头奶牛的解决顺序,对其他奶牛所产生的贡献并没有影响. 我们设距离为$a_{i}$,每分钟贡献$b_{i}$ $a_{1}$        $b_{1}$ $a_{2}$        $b_{2}$ 先抓第一头的代价:$a_{1}b_{1}+2a_{1}b_{2}+a_{2}b_{2}$ 先抓第二头的代价:$a_{2}b_{2}+2a_{2…
1634: [Usaco2007 Jan]Protecting the Flowers 护花 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 885  Solved: 575[Submit][Status][Discuss] Description Farmer John went to cut some wood and left N (2 <= N <= 100,000) cows eating the grass, as usual. When…
P2878 [USACO07JAN]保护花朵Protecting the Flowers 题目描述 Farmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as usual. When he returned, he found to his horror that the cluster of cows was in his garden eating his beautiful…