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
题目:Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a funct....
分类:
编程语言 时间:
2014-07-22 22:47:55
阅读次数:
214
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
#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
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.以下为补充知识,百度到的罗马数字写法:个位数举例I, 1 】II, 2】 III, 3】...
分类:
其他好文 时间:
2014-07-22 00:04:34
阅读次数:
190
#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
Ignatius and the Princess II
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4571 Accepted Submission(s): 2733
Problem Descriptio...
分类:
其他好文 时间:
2014-07-21 23:21:04
阅读次数:
424
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