码迷,mamicode.com
首页 >  
搜索关键字:maximum sum subarray    ( 25087个结果
Codeforces Helpful Maths
Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation. The teacher has written down the sum of multiple numbers. Pupils should ca...
分类:其他好文   时间:2014-07-22 23:05:53    阅读次数:382
UVA 1484 - Alice and Bob's Trip(树形DP)
题目链接:1484 - Alice and Bob's Trip 题意:BOB和ALICE这对狗男女在一颗树上走,BOB先走,BOB要尽量使得总路径权和大,ALICE要小,但是有个条件,就是路径权值总和必须在[L,R]之间,求最终这条路径的权值。 思路:树形dp,dp[u]表示在u结点的权值,往下dfs的时候顺带记录下到根节点的权值总和,然后如果dp[v] + w + sum 在[l,r]内,...
分类:其他好文   时间:2014-07-22 23:05:33    阅读次数:486
LeetCode - Best Time to Buy and Sell 3
这道题在前两个的基础上做稍微改进就可以。下面是AC代码: 1 /** 2 * Design an algorithm to find the maximum profit. You may complete at most two transactions. 3 * @pa...
分类:其他好文   时间:2014-07-22 23:01:13    阅读次数:251
LeetCode5:Longest Palindromic Substring
题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo...
分类:其他好文   时间:2014-05-01 20:07:13    阅读次数:429
[伯努利数] poj 1707 Sum of powers
题目链接: http://poj.org/problem?id=1707 Language: Default Sum of powers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 735   Accepted: 354 D...
分类:其他好文   时间:2014-05-01 18:36:32    阅读次数:385
js:深入函数(函数是对象)
//由于函数是对象,所以可以直接把函数通过参数传递进来;也可以把函数作为返回值。 function calFun(fun,arg){   //第一个参数就是函数对象   return fun(arg); } function sum(num){   return num+100; } function say(str){   alert("hello "+str); } //...
分类:Web程序   时间:2014-04-30 22:41:38    阅读次数:324
[ACM] hdu 1003 Max Sum(最大子段和模型)
Max Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 135262    Accepted Submission(s): 31311 Problem Description   Given a sequen...
分类:其他好文   时间:2014-04-30 22:21:40    阅读次数:280
NYOJ 215 Sum
NYOJ 215 Sum...
分类:其他好文   时间:2014-04-29 13:25:20    阅读次数:192
数组求和的快速方法(利用cuda的共享内存)--第一部分之源码分析
代码来自于这里 https://code.google.com/p/stanford-cs193g-sp2010/source/browse/trunk/tutorials/sum_reduction.cu...
分类:其他好文   时间:2014-04-29 13:13:20    阅读次数:324
Leetcode:Add Binary 二进制相加
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 思路同十进制的大数相加。代码如下: class Solution { public: string addBinary(string a, str...
分类:其他好文   时间:2014-04-29 13:12:20    阅读次数:328
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!