杭电的图论题目列表,共计500题,努力刷吧
AC 64ms
#include
#include
#include
#include
#include
const int INF = 1e8;
using namespace std;
int father[100010];
bool vis[100010];
int findx(int r)
{
int i = r,j;
...
分类:
其他好文 时间:
2014-08-05 11:19:39
阅读次数:
235
例如下面的html代码,要获取P元素下面a元素的个数:
……
我们可以这样写:
$("#father a").length...
分类:
Web程序 时间:
2014-07-31 17:18:57
阅读次数:
238
这里的思路是 在每一次的找父亲节点的时候我们把每一个孩子的父亲的改成他的祖先。因为有可能一个孩子的关系很复杂可能就是一条链,这样查找就没浪费时间。//这是简单的递归实现find (int x){ while(x!=father[x]) father[x] = find(father[x]) ; r....
分类:
其他好文 时间:
2014-07-31 09:38:15
阅读次数:
205
bool is_left( int n )//是否为左节点{ return n % 2 == 0;}bool is_right( int n )//是否为右节点{ return 0 != n && ! is_left( n );}int father( int n )//父亲节点{ if ( ...
分类:
其他好文 时间:
2014-07-29 13:42:48
阅读次数:
182
# include
# include
# include
using namespace std;
int father[1010];
int next[1010];//当前集合的下个元素(包括i)
int pre[1010];//当前集合的上个元素(包括i)
int num[1010];//num[i]当前集合储存的点的个数(包括i)
int vis[1010];
int sum[101...
分类:
其他好文 时间:
2014-07-23 22:39:47
阅读次数:
446
题目:hdoj1166
分析:题意很清晰,就是让你给某个点又增加或者减少x个,然后求某一段有多少个,我是用一个father数组保存叶子节点的编号,然后直接从当前节点开始,更轻到root就ok。
查询的话,从根节点开始,看在左子区间还是右子区间,直接查询到某一段全部在要查询的区间内,求和就ok,很简单。
代码:
#include
#include
#include
...
分类:
其他好文 时间:
2014-07-22 14:33:54
阅读次数:
231
handle*(n)把手,把柄 *(v)处理,解决Turn the Handle to open the door.oppose op=相反 +pose postion位置处于相反的位置或立场Thy boy opposes his father's smoking;he's always try.....
分类:
其他好文 时间:
2014-07-21 11:24:31
阅读次数:
226
相对Java而言,友元是C++中特有的一种元素,再加上《C++ Primer》也并没有太详细的例子,所以刚接触这个概念的时候懵了很久,即是自己总结一下,也希望能帮到大家,下面来讲讲友元的用法和一些注意的地方。
操作:
1)在MyFriend类中,将Father类定义成友元
2)写一个Son类继承自Father类
3)在Father类和Son类的构造函数中分别创建MyFriend对象...
分类:
编程语言 时间:
2014-07-18 12:31:27
阅读次数:
272
#include #include #include #include #include #include #include #include #include #include #include using namespace std;int father[1000];int getfather(...
分类:
其他好文 时间:
2014-07-18 08:13:00
阅读次数:
153
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int father[22222];int ...
分类:
其他好文 时间:
2014-07-16 18:06:07
阅读次数:
235