码迷,mamicode.com
首页 >  
搜索关键字:k sum    ( 21381个结果
find the closest sum to a target value
problem: given an array of integers including positive and negative, a target value. find 2 numbers in the array such that the sum of the 2 numbers is...
分类:其他好文   时间:2014-08-27 03:53:57    阅读次数:227
优化之dierectional search algorihtms
$\Huge a_{1}$\begin{aligned}\dot{x} & = \sigma(y-x) \\\dot{y} & = \rho x - y - xz \\\dot{z} & = -\beta z + xy\end{aligned}$\left( \sum_{k=1}^n a_k b_k...
分类:Web程序   时间:2014-08-27 01:36:07    阅读次数:200
23. Sum Root to Leaf Numbers
思想: 分三种情况: 1. 当前结点为空,返回0. 2. 叶子结点, 返回当前值. 3. 父结点,返回左右两个 path 值的和。
分类:其他好文   时间:2014-08-27 00:22:06    阅读次数:194
LeetCode: Path Sum
LeetCode: Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equal...
分类:其他好文   时间:2014-08-27 00:07:27    阅读次数:298
Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [?2,1,?3,4,?1,2,1...
分类:其他好文   时间:2014-08-26 22:44:46    阅读次数:212
hdu 4961 Boring Sum (思维 哈希 扫描)
题目链接题意:给你一个数组,让你生成两个新的数组,A要求每个数如果能在它的前面找个最近的一个是它倍数的数,那就变成那个数,否则是自己,C是往后找,输出交叉相乘的和分析:这个题这种做法是O(n*sqrt(n))的复杂度,极限数据绝对会超时,但是这个题的数据有点水,所以可以过。用vis【i】数组表示离数...
分类:其他好文   时间:2014-08-26 21:14:26    阅读次数:171
Yii实现分页的两种方法
一. DAO实现分页. [Controller层] public?function?actionReport() ????{ ????????$sql?=?"select?remitdate,?sum(rate)?sumrate?from?td_delivery? ????????????group?by?r...
分类:其他好文   时间:2014-08-26 20:01:16    阅读次数:261
hdu 1166
只是纪念1A #include #include #include using namespace std; #define maxx 50050 int bit[maxx],a[maxx]; int n; int aa,bb; char s[10]; int sum(int i){ int s=0; while (i>0){ s+=bit[i]; ...
分类:其他好文   时间:2014-08-26 19:42:26    阅读次数:166
Path Sum系列
Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give...
分类:其他好文   时间:2014-08-26 17:05:36    阅读次数:156
HDU 4981 Goffi and Median
题解:排序取中位数,然后与平均数比较即可。#include #include using namespace std;double a[1005],ave,med,sum; int n;int main(){ while(~scanf("%d",&n)){ sum=0; ...
分类:其他好文   时间:2014-08-26 15:14:16    阅读次数:166
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!