码迷,mamicode.com
首页 >  
搜索关键字:combination sum    ( 21657个结果
初识算法
1.accumulate的用法:int sum = accumulate(ivec.begin(), ivec.end(), 0 );第三个参数时累加的初值,更重要的是accumulate对要累加元素的类型一无所知,所以容器内的类型要与第三个实参的类型匹配,或者可转换成第三个实参的类型。2.find...
分类:其他好文   时间:2014-06-15 22:42:19    阅读次数:285
poj 3233 Matrix Power Series(等比矩阵求和)
http://poj.org/problem?id=3233 ps转: 用二分方法求等比数列前n项和:即   原理:   (1)若n==0   (2)若n%2==0     (3)若n%2==1 代码如下: LL sum(LL p,LL n) { if(n==0) return 1; i...
分类:其他好文   时间:2014-06-15 20:01:44    阅读次数:210
Combination Sum
题目 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C un...
分类:其他好文   时间:2014-06-15 20:00:18    阅读次数:185
LeetCode:Path Sum II
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 and sum = 22, 5 ...
分类:其他好文   时间:2014-06-15 19:55:39    阅读次数:191
LeetCode——Path Sum
Given 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 given sum. For example: Given the below binary tree and sum ...
分类:其他好文   时间:2014-06-15 19:26:23    阅读次数:207
Combination Sum II
题目 Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once in...
分类:其他好文   时间:2014-06-15 19:24:21    阅读次数:229
LeetCode:Path Sum
Given 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 given sum. For example: Given the below bin...
分类:其他好文   时间:2014-06-15 09:34:35    阅读次数:226
hdu 2489 Minimal Ratio Tree(dfs枚举 + 最小生成树)~~~
题目:         链接:点击打开链接 题意:         输入n个点,要求选m个点满足连接m个点的m-1条边权值和sum与点的权值和ans最小,即sum/ans最小,并输出所选的m个点,如果有多种情况就选第一个点最小的,如果第一个点也相同就选第二个点最小的........ 求一个图中的一颗子树,使得Sum(edge weight)/Sum(point weight)最小~ 数据...
分类:其他好文   时间:2014-06-14 07:05:34    阅读次数:350
hdu-4453-Looploop-splay
真的被这道题目恶心到了。。。281行代码。。。比一个模拟题还费事。。。 为了方便起见,在数列的前面和后面都加一个0点。 add x :把第k2+2个点旋转至root1.然后sum[root10]+=x; reverse:把第k1+2个点旋转至root1.然后rev[root10]^=1;  insert x:得到第2个点,然后在第2个点之后插入x。  delete :把第1个点旋...
分类:其他好文   时间:2014-06-14 00:54:26    阅读次数:324
【Leetcode】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 or right at...
分类:其他好文   时间:2014-06-13 20:36:56    阅读次数:280
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!