码迷,mamicode.com
首页 >  
搜索关键字:minimum sum lcm    ( 24851个结果
初识算法
1.accumulate的用法:int sum = accumulate(ivec.begin(), ivec.end(), 0 );第三个参数时累加的初值,更重要的是accumulate对要累加元素的类型一无所知,所以容器内的类型要与第三个实参的类型匹配,或者可转换成第三个实参的类型。2.find...
分类:其他好文   时间:2014-06-15 22:42:19    阅读次数:285
[leetcode]Minimum Window Substring @ Python
原题地址:https://oj.leetcode.com/problems/minimum-window-substring/题意:Given a string S and a string T, find the minimum window in S which will contain all...
分类:编程语言   时间:2014-06-15 22:10:42    阅读次数:1109
topcoder SRM 624 DIV2 CostOfDancing
排个序,求前k个元素和即可 int minimum(int K, vector danceCost) { sort(danceCost.begin(),danceCost.end()); return accumulate(danceCost.begin()...
分类:其他好文   时间:2014-06-15 21:53:14    阅读次数:201
topcoder SRM 624 DIV2 BuildingHeightsEasy
从大到小遍历一遍,每次取M个元素,然后求得最小的floor即可 int minimum(int M, vector heights) { sort(heights.begin(),heights.end()); int minFloor = 10000; ...
分类:其他好文   时间:2014-06-15 21:48:45    阅读次数:229
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
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
[Leetcode] Binary Tree Maximum Path Sum
Question:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, .....
分类:其他好文   时间:2014-06-14 20:59:07    阅读次数:188
Leetcode:Triangle
Decription:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, gi...
分类:其他好文   时间:2014-06-14 19:46:12    阅读次数:251
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!