递归输出就行了
#include
using namespace std;
struct tree{
int dot;
string s;
}t[1020];
int si[1020],a[1020][1020];
void print(int x)
{
for(int i=0;i<=si[x]-1;i++)
{
for(int j=1;j<=t[...
分类:
其他好文 时间:
2014-07-27 11:48:53
阅读次数:
188
10628. Count on a treeProblem code: COTYou are given a tree with N nodes.The tree nodes are numbered from 1 to N.Each node has an integer weight.We wi...
分类:
其他好文 时间:
2014-07-27 10:31:42
阅读次数:
304
Description
Given a connected undirected graph, tell if its minimum spanning tree is unique.
Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of...
分类:
其他好文 时间:
2014-07-26 17:19:22
阅读次数:
401
原理就是先利用两个数间的差分,因为把一段连续的数做标记相当于头差分+1,尾差分-1,然后做前缀和即可。可以想到,相比segment tree这种个只适合于查询操作不多但修改操作很多的情况(如果保存前缀和修改又会降速),否则计算前缀和会很费时。/*ID:esxgx1LANG:C++PROG:hdu15...
分类:
其他好文 时间:
2014-07-26 17:05:31
阅读次数:
233
Compared with I version, the tree could be incomplete. The only difference is that, we connect current node's child to next non-childrenless' node's f...
分类:
其他好文 时间:
2014-07-26 17:02:11
阅读次数:
316
Description
Christmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture.
The tree can ...
分类:
其他好文 时间:
2014-07-26 15:01:50
阅读次数:
300
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example: Given binary tree {3...
分类:
其他好文 时间:
2014-07-26 14:03:16
阅读次数:
174
375.Query on a tree 【QTREE】 有两个操作: (1)修改第i条边的边权 (2)询问a到b路径上的边权最大值。 树链剖分入门题。树链剖分+线段树维护最大值。修改/查询均为O(log^2)。 很懒,没有写。913.Query on a tree II 【QTREE2...
分类:
其他好文 时间:
2014-07-26 13:53:45
阅读次数:
569
题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.题解:这道题可以应用之前解过的Largetst Recta....
分类:
编程语言 时间:
2014-07-26 09:55:57
阅读次数:
301
在封装Javax Swing的Tree对象时,需要为其每个节点设置不同的图标。故封装了一个公共方法:
{CSDN:CODE:435261}
使用方法:
jTree1.setCellRenderer(new TreeNodeRender(casesIcon));
需要注意的是caseIcon为一个List对象.
示例如图,传入了3个ImageIcon对象,按...
分类:
其他好文 时间:
2014-07-26 02:24:26
阅读次数:
324