码迷,mamicode.com
首页 >  
搜索关键字:combination sum ii    ( 27716个结果
【LeetCode】3Sum Closest
Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m...
分类:其他好文   时间:2014-05-23 03:21:10    阅读次数:287
动态规划(6)——NYOJ469擅长排列的小明II*
擅长排列的小明 II描述小明十分聪明,而且十分擅长排列计算。有一天小明心血来潮想考考你,他给了你一个正整数n,序列1,2,3,4,5......n满足以下情况的排列:1、第一个数必须是12、相邻两个数之差不大于2你的任务是给出排列的种数。输入多组数据。每组数据中输入一个正整数n(n#include#...
分类:其他好文   时间:2014-05-23 03:01:21    阅读次数:326
006:欧拉项目平方和与和的平方的差
Sum square difference Problem 6 The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ....
分类:其他好文   时间:2014-05-23 02:22:57    阅读次数:193
hdu 4825 Xor Sum(字典树)
题目链接:hdu 4825 Xor Sum 题目大意:中文题。 解题思路:将给定得数按照二进制建成一颗字典树,每一层分别对应的各个位数上的01状态。然后每一次查询,如果对应位置为0,则要往1的方向走,如果是1,则要往0的方向走。但是要注意,走的前提是对应分支是存在的。 #include #include #include using namespace std; //type...
分类:其他好文   时间:2014-05-23 02:15:15    阅读次数:286
POJ 1191 棋盘分割
刷了这么长时间POJ了   可算看到了一个中文题,不容易啊~~。 题目大意:自己看。 解题思路: dp[x1][y1][x2][y2][num]代表从(x1,y1)到(x2,y2)分成num+1块最小的平方和是多少。 下面是代码: #include #include #include int sum[10][10],board[10][10]; d...
分类:其他好文   时间:2014-05-22 23:06:07    阅读次数:300
LeetCode: Permutations II [046]
【题目】 Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1]. 【题意】 给定一个候选数集合,候选集中可能存在重复数,返回所有的排列 【思路】 ...
分类:其他好文   时间:2014-05-22 17:32:17    阅读次数:247
LeetCode: Jump Game II [044]
【题目】 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of ju...
分类:其他好文   时间:2014-05-22 17:02:20    阅读次数:244
【LeetCode】3Sum
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen...
分类:其他好文   时间:2014-05-22 16:53:52    阅读次数:173
SnakeGo : Scaling Screen on Stage II
昨晚把BaseScreen就敲好了, 也找到了屏幕放缩的最优和最简方式. 不多说, 看代码: public BaseScreen(final SnakeGo game) { super(new ScalingViewport(Scaling.fit, CommonConsts.Screen.WIDT...
分类:其他好文   时间:2014-05-22 14:52:32    阅读次数:206
hdu 1024 Max Sum Plus Plus (DP)
Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15817Accepted Submission(s): 5140...
分类:其他好文   时间:2014-05-22 14:06:42    阅读次数:250
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!