码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
HDU-3280 Equal Sum Partitions
http://acm.hdu.edu.cn/showproblem.php?pid=3280用了简单的枚举。Equal Sum PartitionsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Othe...
分类:其他好文   时间:2014-07-22 22:48:13    阅读次数:218
[leetcode]Triangle
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given...
分类:其他好文   时间:2014-07-22 22:47:52    阅读次数:230
Two Sum leetcode java
题目: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 tw....
分类:编程语言   时间:2014-07-22 22:47:33    阅读次数:256
3 Sum leetcode java
题目: 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...
分类:编程语言   时间:2014-07-22 22:47:16    阅读次数:252
状态问题吗?水题错四次了…………
#includemain(){int n,i,sum;int x[10];while(scanf("%d %d %d %d %d %d",&x[1],&x[2],&x[3],&x[4],&x[5],&x[6])!=EOF){if(x[1]==0&&x[2]==0&&x[3]==0&&x[4]==0&...
分类:其他好文   时间:2014-07-22 22:46:14    阅读次数:210
Codeforces #256 Div.2
B. Suffix Structure 1. 先判断s去掉一些元素是否能构成t,如果可以就是automaton 判断的方法也很简单,two pointer,相同元素同时++,不相同s的指针++,如果t能全找到,那么s能够去掉元素构成t。 bool f(string s, string t) { in...
分类:其他好文   时间:2014-07-22 22:44:54    阅读次数:139
P50
#include #include int fun (int high) { int sum=0,n=0,j,yes; while((high>=2)&&(n<10)) { yes=1; for(j=2;j<=high/2;j++) if(high%j==0) { yes=0;break; } if(yes) { sum+=high; ...
分类:其他好文   时间:2014-07-22 00:11:34    阅读次数:226
树状数组改点求段
#includeint a[20],n;int lowbit(int x){ return x&(-x);}void add(int x,int c){ int i; for(i=x; i<=n; i+=lowbit(i))a[i]+=c;}int sum(int x){ i...
分类:其他好文   时间:2014-07-21 23:30:00    阅读次数:240
POJ 2739 Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive ...
分类:其他好文   时间:2014-07-21 22:18:12    阅读次数:222
动态规划第六讲——leetcode上的动态规划汇总(下)
接下来的几道题,都是有关路径问题,这可以说是DP问题的一种典型应用。路径有一个维度的;也有两个维度的。 Eg10:Climbing Stairs 这道题目比较简单,重在分析思路。 Eg11:Minimum Path Sum  分析:略 class Solution { public: int minPathSum(v...
分类:其他好文   时间:2014-07-21 16:48:55    阅读次数:191
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!