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
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
题目: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
题目: 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
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
#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
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
接下来的几道题,都是有关路径问题,这可以说是DP问题的一种典型应用。路径有一个维度的;也有两个维度的。
Eg10:Climbing Stairs
这道题目比较简单,重在分析思路。
Eg11:Minimum Path Sum
分析:略
class Solution {
public:
int minPathSum(v...
分类:
其他好文 时间:
2014-07-21 16:48:55
阅读次数:
191