Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:
其他好文 时间:
2014-10-23 15:39:15
阅读次数:
149
2226: [Spoj 5971] LCMSumTime Limit:20 SecMemory Limit:259 MBSubmit:578Solved:259[Submit][Status]DescriptionGiven n, calculate the sum LCM(1,n) + LCM(2...
分类:
其他好文 时间:
2014-10-22 23:40:27
阅读次数:
389
http://acm.hdu.edu.cn/showproblem.php?pid=3709题意:在一个区间内有多少个,可以一这个数中的一个数字为支点,两边的数字乘上边距的和相等。数位dp,枚举支点。 1 #include 2 #include 3 #include 4 #define ll ...
分类:
其他好文 时间:
2014-10-22 21:35:24
阅读次数:
228
Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre...
分类:
其他好文 时间:
2014-10-22 12:29:07
阅读次数:
171
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe...
分类:
其他好文 时间:
2014-10-22 01:06:01
阅读次数:
162
题目:spoj 375. Query on a tree
题意:题意很清晰,就是给你一颗树,每两点之间有权值,然后改变一些权值,问一条路径上的最大值。
分析:入门题目,直接套树链模板
AC代码;
#include
#include
#include
#include
using namespace std;
const int N = 10010;
#define ...
分类:
其他好文 时间:
2014-10-21 12:16:36
阅读次数:
210
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 1 /** 2 * Definition for singly-linked ....
分类:
其他好文 时间:
2014-10-21 03:33:45
阅读次数:
168
[leetcode]Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST....
分类:
其他好文 时间:
2014-10-20 11:49:53
阅读次数:
114
既然是bronze,毫无压力的AC了.就是个深搜,当然加个剪枝--最后一个组不用搜.恩可以一个一个组分层次dfs,这样会跑得飞起~~也不容易错#include int f[13],i,su,tt1,tt2,lev[4],min;bool has[13];inline int md(int a,int...
分类:
其他好文 时间:
2014-10-19 23:01:39
阅读次数:
270
New Distinct SubstringsTime Limit: 2000msMemory Limit: 262144KBThis problem will be judged onSPOJ. Original ID:SUBST164-bit integer IO format:%lld Jav...
分类:
其他好文 时间:
2014-10-18 23:41:43
阅读次数:
283