递归,dfs这里返回值是一个pair,first表示两个子树的不经过当前root的最大pathsum;second表示两个子树的,以root->left和root->right为路径起始节点的路径的最大值 1 /** 2 * Definition for binary tree 3 * stru.....
分类:
其他好文 时间:
2014-09-07 19:43:15
阅读次数:
195
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-09-07 14:41:25
阅读次数:
240
题目链接:poj 3693 Maximum repetition substring
题目大意:求一个字符串中循环子串次数最多的子串。
解题思路:对字符串构建后缀数组,然后枚举循环长度,分区间确定。对于一个长度l,每次求出i和i+l的LCP,那么以i为起点,循环子串长度为l的子串的循环次数为LCP/l+1,然后再考虑一下从i-l+1~i之间有没有存在增长的可能性。
#include ...
分类:
其他好文 时间:
2014-09-05 23:53:12
阅读次数:
412
现象,这个网站我总计能抽取将近500个URL,但实际只抽取了100条解析:nutch默认从一个页面解析出的链接,只取前 100 个。 db.max.outlinks.per.page 100 The maximum number of outlinks that we'll process ...
分类:
其他好文 时间:
2014-09-05 12:46:31
阅读次数:
162
1.内存条数:dmidecode|grep-P-A5"Memory\s+Device"|grepSize|grep-vRange2.内存最大容量:dmidecode|grep-P‘Maximum\s+Capacity‘3.内存频率:dmidecode|grep-A16"MemoryDevice"|grepSpeed
分类:
系统相关 时间:
2014-09-05 10:11:01
阅读次数:
226
POI操作Excel中,导出的数据不是很大时,则不会有问题,而数据很多或者比较多时,就会报以下的错误,是由于cell styles太多create造成,故一般可以把cellstyle设置放到循环外面报错如下:Caused by: java.lang.IllegalStateException: Th...
分类:
其他好文 时间:
2014-09-04 23:29:21
阅读次数:
408
host1:~#echomidware1|passwd--stdinmidwareChangingpasswordformidware.passwd:Haveexhaustedmaximumnumberofretriesforservice修改/etc/pam.d/common-passwordpasswordrequiredpam_pwhistory.soremember=5retry=3修改remember参数为1,修改完密码之后再将参数恢复。
分类:
其他好文 时间:
2014-09-03 13:18:17
阅读次数:
1296
poj2699:http://poj.org/problem?id=2699题意:n个人,进行n*(n-1)/2场比赛,赢一场则得到一分。如果一个人打败了所有比他分数高的对手,或者他就是分数最高的,那么他就是strong kind。现在给你每个人的得分,问你最多有多少个strong kind。题解:...
分类:
其他好文 时间:
2014-09-02 17:31:15
阅读次数:
246
问题描述:
给定一个整数序列, 序列中可能有负数。 目的是找出这个序列的连续子序列(即子序列的元素的选取是连续的从序列中选取的)。即通过确定i,
j 的值, 使得的值达到最大。 我们定义, 当所有的元素为负数值的时候, 那么maximum subsequence sum
为0。
下面我们用动态规划的技术去求解。
为了找到最大连续子序列和, 不难看出, 在扩展我们的求和窗口...
分类:
其他好文 时间:
2014-09-02 16:00:14
阅读次数:
187
原文链接地址:http://www.52nlp.cn/maximum-matching-method-of-chinese-word-segmentation/ 逆向匹配法思想与正向一样,只是从右向左切分,这里举一个例子: 输入例句:S1=”计算语言学课程有意思” ; 定义:最大词长M...
分类:
其他好文 时间:
2014-09-02 13:55:34
阅读次数:
248