码迷,mamicode.com
首页 >  
搜索关键字:combination sum    ( 21657个结果
百度之星资格赛,hdu 4825 XOR SUM
2014 百度之星资格赛,xor sum ,显然是要建一棵0、1树 其实很简单就是二叉树,只不过为了操作简便,即程序的速度,所以就采用静态树,即不动态分配内存,使用较大的全局数组。...
分类:其他好文   时间:2014-05-26 05:47:20    阅读次数:220
leetcode题目:Sum Root to Leaf Numbers和Longest Consecutive Sequence
题目一: 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 represents the number 123. Fin...
分类:其他好文   时间:2014-05-26 04:06:41    阅读次数:248
欧拉项目010:2000000以内的素数和
Summation of primes Problem 10 The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. 还是使用Sieve of Eratosthenes 算法 我的python代码如下: ...
分类:其他好文   时间:2014-05-26 03:40:15    阅读次数:243
LeetCode:3Sum
题目:         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...
分类:其他好文   时间:2014-05-25 00:39:37    阅读次数:343
LeetCode: Maximum Subarray [052]
【题目】 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [?2,1,?3,4,?1,2,1,?5,4], the contiguous subarray [4,?1,2,1] has the largest sum = 6. 【题意】 给定一个数组,找出和最大的子数组,返回...
分类:其他好文   时间:2014-05-24 22:19:17    阅读次数:260
2014百度之星资格赛——XOR SUM
2014百度之星资格赛——XOR SUM Problem Description Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。P...
分类:其他好文   时间:2014-05-24 20:53:55    阅读次数:266
poj 3031 Big Christmas Tree(水spfa)
http://poj.org/problem?id=3013 题意: Because of a technical difficulty, price of an edge will be (sum of weights of all descendant nodes) × (unit price of the edge).这句话一直没看懂。后面还以为是最小生成树。 正确...
分类:其他好文   时间:2014-05-24 20:27:13    阅读次数:266
Leetcode的bug测试用例 ?? jump game
之所以说leetcode的测试用例有问题,是因为我刚开始理解错了题意,写下了如下的错误的代码。但是却AC了。 错误代码为: bool canJump(int A[], int n) { if(n == 0) return true; int sum = 0; //记录当前的最远距离 int i = 0; ...
分类:其他好文   时间:2014-05-24 19:45:57    阅读次数:1081
2014 百度之星 1003 题解 Xor Sum
Xor Sum Problem Description Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeu...
分类:其他好文   时间:2014-05-24 17:53:54    阅读次数:177
Light0J-1068 - Investigation
An integer is divisible by 3 if the sum of its digits is also divisible by 3. For example, 3702 is divisible by 3 and 12 (3+7+0+2) is also divisible by 3. This property also holds for the integer 9. ...
分类:其他好文   时间:2014-05-24 14:30:47    阅读次数:208
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!