码迷,mamicode.com
首页 >  
搜索关键字:sum problem    ( 57617个结果
[leetcode]Two Sum @ Python
原题地址:http://oj.leetcode.com/problems/two-sum/题意:找出数组numbers中的两个数,它们的和为给定的一个数target,并返回这两个数的索引,注意这里的索引不是数组下标,而是数组下标加1。比如numbers={2,7,11,17}; target=9。那...
分类:编程语言   时间:2014-04-30 21:45:43    阅读次数:528
nyoj 708 ones 动态规划
http://acm.nyist.net/JudgeOnline/problem.php?pid=708状态转移方程的思路:对于一个数N,可以是N - 1的状态+1 得到,另外,也可以是(n / 2) * (1 + 1)得到,同理对于任意的奇数p,都有如果n可以整除p,都有f(n / p) + f(...
分类:其他好文   时间:2014-04-30 21:26:26    阅读次数:519
UVA 10891 Game of Sum(DP)
This is a two player game. Initially there areninteger numbers in an array and playersAandBget chance to take them alternatively. Each player can take...
分类:其他好文   时间:2014-04-30 20:34:38    阅读次数:519
整数性质和精度测试
题目:http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=612 1 /*http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=612 2 关键是对数处理位数...
分类:其他好文   时间:2014-04-30 19:46:56    阅读次数:411
Conceptual blockbusting--chap4 Cultural and Environmental blocks
Cultural blocks1) TaboosPing-pong ball exerciseTaboos can remove entire families of solutions from the ready grasp of the problem-solver. This is not ...
分类:其他好文   时间:2014-04-30 18:17:21    阅读次数:462
HNU 10111 0-1矩阵
http://acm.hnu.cn/online/?action=problem&type=show&id=10111题意:中文题解:在龙哥的帮助下正了二分图匹配的三观……以前的理解繁琐,或者有点儿错吧……二分图匹配从左往右匹配,找增广路。顶点数和match()不需要那么麻烦。 1 // 2 /.....
分类:其他好文   时间:2014-04-29 18:30:30    阅读次数:518
《Cracking the Coding Interview》——第17章:普通题——题目8
2014-04-28 23:35题目:最大子数组和问题。解法:O(n)解法。代码: 1 // 17.8 Find the consecutive subarray with maximum sum in an array. 2 // O(n) online algorithm. 3 #include...
分类:其他好文   时间:2014-04-29 16:35:28    阅读次数:429
JavaScript高级程序设计学习笔记--基本概念
1.语句ECMAScript中的语句以一个分号结尾;如果省略分号,则由解析器确定语句的结尾,如下例所示:var sum=a+b //即使没有分号也是有效的语句--推荐var diff=a-b; //有效的语句--推荐虽然语句结尾的分号不是必需的,但我们建议任何时候都不要省略它。两个原因:1.加上分号...
分类:编程语言   时间:2014-04-29 16:10:53    阅读次数:519
最大子数组和(最大子段和)
比如对于数组[1,-2,3,5,-1,2] 最大子数组和是sum[3,5,-1,2] = 9, 我们要求函数输出子数组和的最大值,并且返回子数组的左右边界(下面函数的left和right参数).本文我们规定当数组中所有数都小于0时,返回数组中最大的数(也可以规定返回0,只要让以下代码中maxsum初...
分类:其他好文   时间:2014-04-29 15:32:49    阅读次数:554
组合数学笔记
组合数学、-排列组合数----sum求sum=sum*(m--)/i;----二维数组递推(打表)---原始公式(单个)数字太大,用分子分母约分-全排列模板-----生成全排列函数prev_permutation和next_permutation区别http://www.cnblogs.com/zh...
分类:其他好文   时间:2014-04-29 10:31:46    阅读次数:408
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!