码迷,mamicode.com
首页 >  
搜索关键字:k sum    ( 21381个结果
HDU 1565
http://acm.hdu.edu.cn/showproblem.php?pid=1565先进行二分图黑白染色,S到黑,白到T,黑到白,问题转化成了求最大权独立集,最大权独立集=sum-最小点权覆盖集,最小点权覆盖集等于上图最小割#include #include #include using ....
分类:其他好文   时间:2014-08-13 21:33:07    阅读次数:207
Codeforces 75D Big Maximum Sum 最大子段和 dp
题目链接:点击打开链接 题意: 第一行 n m n个vector 下面n行 第一个数字u表示vector 的大小,然后后面u个数字给出这个vector 最后一行m个数字 表示把上面的vector拼接起来 得到一个大序列,求这个大序列的最大子段和 先预处理出每个vector的最大子段和,左起连续最大,右起连续最大,所有数的和 然后dp 一下。。 #include ...
分类:其他好文   时间:2014-08-13 18:55:07    阅读次数:266
Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:其他好文   时间:2014-08-13 18:17:26    阅读次数:208
leetcode 刷题之路 83 Maximum Subarray
思路:从左向右遍历数组元素相加求和得到和sum,若sum小于0,必然会对总的和有损耗,因此将sum重置为0,从当前位置继续重复上述过程,直到数组结束,与此同时设置max变量记录求和过程中遇到的最大值。 执行完上述过程,判断max等于0(max初值为0),若大于0,max为所求结果,返回max。 若仍然等于0说明求和过程中未出现过正数,数组中全是负数或0,此时数组最大和就是数组中最大的最...
分类:其他好文   时间:2014-08-13 15:01:56    阅读次数:211
leetcode -- Two Sum
文能深情寻萝莉,武能仗义护人妻[问题描述]Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return ...
分类:其他好文   时间:2014-08-13 14:51:56    阅读次数:228
double 与0比较时有个精度问题,有时需精确到小数点后面几位,例如与>0.0001,而不能与>0比较
double 与0比较时有个精度问题,有时需精确到小数点后面几位,例如与>0.0001,而不能与>0比较例如杭电1408盐水的故事ac#includeusing namespace std;int main(){ double vul,d; int sum; int n; while(cin...
分类:其他好文   时间:2014-08-13 14:47:36    阅读次数:184
keys
1.double 与0比较时有个精度问题,有时需精确到小数点后面几位,例如与>0.0001,而不能与>0比较例如杭电1408盐水的故事ac#includeusing namespace std;int main(){ double vul,d; int sum; int n; while(c...
分类:其他好文   时间:2014-08-13 14:41:56    阅读次数:469
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 andsum =...
分类:其他好文   时间:2014-08-13 14:39:26    阅读次数:153
一个简单的存储过程
create procedure proc_pay(@maxmoney int,@minmoney int,@paymonth nvarchar(20))as begin select 储值方式,sum(台币) from 储值分析 where uid in (select uid from 储值分析...
分类:其他好文   时间:2014-08-13 14:21:26    阅读次数:140
poj 1195 二维树状数组 及二维树状数组模板
http://poj.org/problem?id=1195 求矩阵和的时候,下标弄错WA了一次... 求矩形(x1,y1) (x2,y2)的sum |sum=sum(x2,y2)-sum(x1-1,y2)-sum(x2,y1-1)+sum(x1-1,y1-1) 二维树状数组讲解:http://blog.csdn.net/u011026968/article/details/38532...
分类:其他好文   时间:2014-08-13 13:14:06    阅读次数:260
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!