- 博客(4)
- 资源 (1)
- 收藏
- 关注
原创 POJ 3928 Ping pong
题目:有n个人,每个人都有对应的值,现在他们要做游。游戏的规则:3个人一组,必须有一个人的值介于其他两个之间。思路:现在有n个人,用第i个人取个例子。在第i个人的左边,有C个人比第i个人的值小,那么就有(i-1-C)个比第i个人大在第i个人的右边,有D个人比第i个人的值小,那么就有(n-i-D)个比第i个人大那么左边小右边大的组合有:C*(n-i-D)个那么左边大右边小
2015-01-13 19:16:57 640
原创 UVA 1329 - Corporative Network
求节点到根结点的距离。用一个D数组保存每一个节点到根结点的距离。在I操作的时候路径压缩,更新D数组。#include#includeint abs(int x){return x>0?x:-x;}const int maxn=20000+20;int pa[maxn],d[maxn];int find(int x){ if(pa[x]!=x) { int
2015-01-13 09:53:31 463
原创 UVA 1160 X-Plosives
这道题是一道简单的并查集,题目中说K个混合物只有K个化学品的话。而且两个化学品构成一个混合物。这样的情况的就是化学之间构成了回路,这也符合了并查集的一个特征,判断是否有回路。#include#includeconst int maxn=1e5+100;int pa[maxn];int find(int x){ return pa[x]==x?x:find(pa[x]);
2015-01-13 09:05:46 490
原创 UVA 11997 K Smallest Sums(优先队列)
题目:You're given k arrays, each array has k integers. There are kk ways to pick exactly one element in each array and calculate the sum of the integers. Your task is to find the k smallest sums among
2015-01-12 10:04:15 734
VXG 插件,用于播放RSTP流
2018-12-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人