代码来自baka。。#include#include#include#include#include#include#include#include#include#include#include#define inf 0x3f3f3f3f#define Inf 0x3FFFFFFFFFFFFFFF...
分类:
其他好文 时间:
2014-08-13 22:10:37
阅读次数:
248
参考:http://www.tairan.com/archives/4902参考文章是2.x版本的,对于3.0也许不合适了,没有深究。代码:https://github.com/kenkozheng/cocos2d-js/tree/master/jsbinding(cpp_js%20js_cpp)1...
分类:
编程语言 时间:
2014-08-13 18:27:26
阅读次数:
716
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:
其他好文 时间:
2014-08-13 18:17:26
阅读次数:
208
[syswj@host 0813]$ cat dic_tree.cpp #include #include #define MAX 26using namespace std;typedef struct TrieNode{ int ncount; struct TrieNode *ne...
分类:
其他好文 时间:
2014-08-13 18:04:06
阅读次数:
190
c++/*The following example shows how the OnCustomDrawItem eventhandler draws items and lines of the tree view after the OnCustomDraw event handler has...
分类:
其他好文 时间:
2014-08-13 18:00:26
阅读次数:
306
原题:
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...
分类:
其他好文 时间:
2014-08-13 15:03:31
阅读次数:
261
bfs基础算法水题
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const int Max = 1e5+50;
int dist[Max];
vector tree[Max];
int N, D, T;
void init()
{
for(int i = 0; ...
分类:
其他好文 时间:
2014-08-13 14:56:06
阅读次数:
187
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-08-13 14:39:26
阅读次数:
153
注:这道题思路很乱,先记下,日后理清题意:给出一些节点,判断这些节点构成的是不是一棵树思路:感觉很简单,但是思路又很乱,当时想的判断条件是:1.入度不能大于1(树根为0,其他节点为1)2.所有节点必须在一棵树中(判断所有节点是否在一棵树中)3.在节点相连的时候,不能是同一棵树中的节点(否则会出现环或...
分类:
其他好文 时间:
2014-08-13 14:27:36
阅读次数:
224
hdu 4929 Another Letter Tree(LCA+DP)
题意:有一棵树n个节点(n
解法:一个很直观的想法,求出lca(设其为w)后,枚举x,求出a到w的路径上,能匹配s0的x长度前缀的情况有多少种,令其为c[x]。再求出b到w的路径上能匹配s0的L-x(L表示s0的长度)长度后缀的情况有多少种,令其为d[l-x],那么将所有的c[x]*d[l-x](x属于[0,l]...
分类:
其他好文 时间:
2014-08-13 10:38:05
阅读次数:
346