题目链接:http://poj.org/problem?id=2456二分+贪心这是个求最小值最大的问题,我们二分从0到inf的数d,作为两头牛放置的距离不小于d,然后贪心判断。首先要对x从小到大进行排序,接下来固定x[0]处必有一头牛,然后间距不小于d的时候,可以放置,一直放置,直到所有牛舍均被遍...
分类:
其他好文 时间:
2015-10-22 21:24:08
阅读次数:
277
Aggressive cows http://poj.org/problem?id=2456N间小屋,M头牛,使得牛跟牛之间的距离最远,以防止牛打架。2 File Name: AggressiveCows_poj2456.cpp > Author: spzhao > Mail: spzh...
分类:
其他好文 时间:
2015-10-14 23:23:49
阅读次数:
257
Problem DescriptionLike everyone, cows enjoy variety. Their current fancy is new shapes for pastures. The old rectangular shapes are out of favor; new...
分类:
其他好文 时间:
2015-10-11 16:39:11
阅读次数:
241
一, 最大流 1)拆点 ①满足个体自身的限制 POJ 3281 Dining 最多多少奶牛可以选到心仪的食物和饮料。 因为每个奶牛对答案的贡献至多为一, 所以把每头奶牛拆成两个点, 连一条容量为一的边就可以了。 SPOJ 962 Intergalactic Map 这...
分类:
其他好文 时间:
2015-10-08 14:36:44
阅读次数:
280
Cheapest PalindromeTime Limit:2000MSMemory Limit:65536KTotal Submissions:6013Accepted:2933DescriptionKeeping track of all the cows can be a tricky tas...
分类:
其他好文 时间:
2015-10-05 20:49:04
阅读次数:
222
RunningTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5652Accepted: 2128DescriptionThe cows are trying to become better athletes, so Bessie ...
分类:
其他好文 时间:
2015-10-03 23:13:20
阅读次数:
420
题目大意:有N只牛,每只牛都偏爱吃一种食和饮料,现在有F种食物,D种饮料,现在想要给尽可能多的牛一份美餐。输入数据:一个N代表N只牛, F代表有F种食物, D代表有D种饮料。接下来N行,第i行代表,第i只牛,每行前两个数,Fi, Di 分别代表第i只牛喜欢的食物有Fi种,喜欢的饮料有Di种。然后是F...
分类:
其他好文 时间:
2015-10-01 18:01:08
阅读次数:
170
DescriptionFJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as muc...
分类:
其他好文 时间:
2015-09-26 17:12:17
阅读次数:
189
Problem SolvingTime Limit:2000MSMemory Limit:65536KTotal Submissions:1645Accepted:675DescriptionIn easier times, Farmer John's cows had no problems. T...
分类:
其他好文 时间:
2015-09-26 17:06:05
阅读次数:
204
题意:求从1到n的最短路距离#include #include #include #include #include #include using namespace std;#define maxn 2005int head[maxn];int cnt;int visit[maxn];int di...
分类:
其他好文 时间:
2015-09-26 11:46:20
阅读次数:
110