码迷,mamicode.com
首页 >  
搜索关键字:max sum of max-k-sub    ( 43452个结果
Problem Path Sum II
Problem Description:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Solution: 递归。 1 public List>...
分类:其他好文   时间:2014-07-07 16:59:12    阅读次数:169
Problem Max Points On a Line
Problem Description:Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Solution: 1 public int maxPoint.....
分类:其他好文   时间:2014-07-07 16:55:19    阅读次数:281
Topcoder SRM 626 DIV2 SumOfPower
本题就是求所有连续子数列的和开始拿到题目还以为求的时数列子集的和,认真看到题目才知道是连续子数列循环遍历即可 int findSum(vector array) { int sum = 0; for(int i = 0 ; i < array.size(); ++...
分类:其他好文   时间:2014-07-07 16:10:42    阅读次数:179
Problem Sum Root to Leaf Numbers
Problem Description:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf ...
分类:其他好文   时间:2014-07-07 16:01:34    阅读次数:223
Minimum Path Sum
题目 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down...
分类:其他好文   时间:2014-06-30 11:10:34    阅读次数:211
MYSQL利用Navicat对含有Bold字段表进行导入导出
MYSQL中含有Blob字段是一件挺麻烦的事情,导出导入不方便。我介绍我是怎么做的。 1、在MYSQL的my.ini最后中添加一行配置max_allowed_packet = 100M,重启MYSQL服务 根据实际情况来定这个数值的大小,我这次表里面有82个mediumblob字段,所以设置为100M 2、用XML格式导出数据 3、选择用XML导入数据...
分类:数据库   时间:2014-06-30 09:42:21    阅读次数:323
poj 2723 Get Luffy Out 2-SAT
两个钥匙a,b是一对,隐含矛盾a->!b,b->!a 一个门上的两个钥匙a,b,隐含矛盾!a->b,!b->a(看数据不大,我是直接枚举水的,要打开当前门,没选a的话就一定要选b打开,没选b的话,就一定要选a打开) #include #include #include #include #include #include using namespace std; #define max...
分类:其他好文   时间:2014-06-30 09:41:26    阅读次数:220
Structure and Interpretation of Computer Programs-Exercise 1.3
【问题】 Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers. 定义一个过程,它以三个数为参数,返回其中较大的两个数的平方和。 【普通版】 (define (sum-square-largest x y ...
分类:其他好文   时间:2014-06-30 00:19:52    阅读次数:270
USACO nocows DP
这题没想出来,直接参考了nocow,太弱了= =。 基本思想是动态规划,因为树是递归结构,所以可以递归分成子问题处理。一个树可以看成根加左子树加右子树,所以根据乘法原理,N个节点放成k层的结构等于i个节点放成k - 1层乘以N - i - 1个节点放在k - 1层的积。 令dp[i][j] 为i个节点放j层的最多可能数量,则dp[i][j] = sum{dp[k][j - 1] * dp[i ...
分类:其他好文   时间:2014-06-29 23:49:12    阅读次数:339
JS 基础知识3 变量
变量和数值相关,它储存了那个值,有了变量就可以储存操作数据了。js与其他语言不同,它是非类型的。就是变量可以存放任何类型的值,而其他语言需要存放特定类型的值。var i=5;i="fdsfad";这是合法的。变量的声明一般是由VAR 关键字声明的var i,sum; //一次声明两个变量, 若变量....
分类:Web程序   时间:2014-06-29 19:28:32    阅读次数:153
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!