码迷,mamicode.com
首页 >  
搜索关键字:maximum sum subarray    ( 25087个结果
hdu 3038 (并查集)
题目大意: 给出m个询问,问【l,r】之间的和   ,求出有多少次询问不和之前的矛盾的。 思路分析: 用并查集记录当前节点到根节点的和。 #include #include #include #include #define maxn 222222 using namespace std; int set[maxn]; int sum[maxn]; in...
分类:其他好文   时间:2014-05-07 07:35:05    阅读次数:386
leetcode第一刷_Binary Tree Maximum Path Sum
这是道好题。...
分类:其他好文   时间:2014-05-07 06:33:00    阅读次数:284
HDU 1850 Being a Good Boy in Spring Festival (Nim游戏变形)
题意:经典Nim游戏博弈,给你n堆牌,每堆a[i]张,每次能从一堆中取出任一张(不能为0),最后不能取者为输 问先手有几种取法保证他最后能获胜。 思路:让Nim_sum=0(a[1]^a[2]…………^a[n]=0)时则输,利用这个定理,对于第i堆a[i],除了第i堆,其它的 Nim_sum=k,如果a[i]>k,则先手从第i堆可以取a[i]-k张牌,让a[i]=k,最后a[i]^k...
分类:编程语言   时间:2014-05-07 06:13:32    阅读次数:428
【Leetcode】Two Sum
[Question] Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to t...
分类:其他好文   时间:2014-05-07 05:37:44    阅读次数:278
小强的HTML5移动开发之路(52)——jquerymobile中的触控交互
当使用移动设备进行触控操作时,最常用的就是轻击、按住屏幕或者手势操作,jQuery Mobile可以通过绑定的触控事件来响应使用者的特定触控行为。一、轻击与按住直接上代码(一切皆在代码中,细细品吧!) 练习 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1....
分类:移动开发   时间:2014-05-07 04:45:59    阅读次数:426
小强的HTML5移动开发之路(50)——jquerymobile页面初始化过程
为了方便说明和更加直观的展示jquerymobile的页面初始化过程以及各个事件的触发过程,我绘制了一幅流程图:图中用红色框圈起来的是界面中的事件,测试代码如下: 练习 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;...
分类:移动开发   时间:2014-05-07 04:40:07    阅读次数:450
Codechef Maximum Weight Difference题解
Maximum Weight Difference Chef has gone shopping with his 5-year old son. They have bought N items so far. The items are numbered from 1 to N, and the item i weighs Wi grams. Chef's son insist...
分类:其他好文   时间:2014-05-06 22:59:49    阅读次数:451
leetcode -day9 Candy & Gas Station & Binary Tree Maximum Path Sum
1、 ?? Candy There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must h...
分类:其他好文   时间:2014-05-06 22:41:02    阅读次数:427
NYOJ 640 Geometric Sum
NYOJ 640 Geometric Sum...
分类:其他好文   时间:2014-05-06 15:20:32    阅读次数:229
【Leetcode】3Sum
【Question】 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in ...
分类:其他好文   时间:2014-05-06 14:57:29    阅读次数:318
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!