题意:树上每个节点上有若干苹果,边上带权,问你最小费用使得书上的苹果方差最小。思路:上下费用流问题,参考http://blog.csdn.net/qq564690377/article/details/8870587代码如下:
1 /********************************....
分类:
其他好文 时间:
2014-05-16 21:50:35
阅读次数:
491
Continuous Login
Time Limit: 2 Seconds Memory Limit: 131072 KB Special Judge
Pierre is recently obsessed with an online game. To encourage users to log in, this game will give user...
分类:
其他好文 时间:
2014-05-14 01:25:00
阅读次数:
396
Gao The SequenceTime Limit:2 Seconds Memory
Limit:65536 KBYou are given a sequence of integers,A1,A2,...,An. And you are
allowed a manipulation on the...
分类:
其他好文 时间:
2014-05-13 19:49:14
阅读次数:
277
zoj 3673 1 /** 2 6700417 3 **/ 4 #include 5
#include 6 #include 7 #include 8 #include 9 using namespace std;10 11 typedef
unsigned long long LL;12 13 ...
分类:
其他好文 时间:
2014-05-13 18:07:32
阅读次数:
234
Robert is clipping his fingernails. But the nail clipper is old and the edge of the nail clipper is potholed.
The nail clipper's edge is N millimeters wide. And we use N characters('.' or '*') to rep...
分类:
其他好文 时间:
2014-05-13 15:05:54
阅读次数:
264
Mahjong is a game of skill, strategy and calculation and involves a certain degree of chance. In this problem, we concentrate on Japanese Mahjong, a variation of mahjong. For brief, all of the word ma...
分类:
其他好文 时间:
2014-05-13 14:59:51
阅读次数:
356
1729 is the natural number following 1728 and preceding 1730. It is also known as the Hardy-Ramanujan number after a famous anecdote of the British mathematician G. H. Hardy regarding
a hospital vis...
分类:
其他好文 时间:
2014-05-13 14:52:34
阅读次数:
314
Mahjong is a game of skill, strategy and calculation and involves a certain degree of chance. In this problem, we concentrate on Japanese Mahjong, a variation of mahjong. For brief, all of the word ma...
分类:
其他好文 时间:
2014-05-13 13:54:14
阅读次数:
463
中心节点就是树的中心,2遍dfs求到树的直径,而中心一定在直径上,顺着直径找到中心就够了。
然后可以一遍树形DP找到最小值或者二分+判断是否访问到叶子节点。
#include
#include
#include
#include
using namespace std;
struct node
{
int next;
int power;
int length...
分类:
其他好文 时间:
2014-05-13 11:28:38
阅读次数:
306
思路:半夜了思路有点混乱wa了好几发。一开始坑定两个人距离为m才能获得最大的收益,所以我们就可以枚举单个端点,当距离达到m时在一同一个方向走这是我们只需要算一下剩下几秒,左右两边贪心去最大的即可。代码如下:
1 /*******************************************...
分类:
其他好文 时间:
2014-05-13 09:58:02
阅读次数:
268