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
设$z_{1},\cdots,z_{N}\in\mathbb C$,证明存在$\{1,2,\cdots,N\}$的子集$S$使得$$\left|\sum_{k\in S}z_{k}\right|\geq\frac{1}{\pi}\sum_{k=1}^{N}|z_{k}.|$$证明 设$z_{k}=....
分类:
其他好文 时间:
2014-07-22 00:25:34
阅读次数:
235
#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
Sumdiv
Description
Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).
Input
The only line...
分类:
其他好文 时间:
2014-07-21 16:27:12
阅读次数:
187
题意:
一段固定不变的数字 m次询问 每次询问选择一个x值 使得区间[l,r]中每个元素与x的差的绝对值的和最小
思路:
x值明显选择[l,r]中数字的中位数 那么题目就变成了[l,r]中第(r-l+1+1)/2小的数是几 由于数字是静态的 所以划分树可解
那么ans = num(x) - num(>x) * x
由于sum之间可由前缀和相互求出 num也可以通过...
分类:
其他好文 时间:
2014-07-21 16:16:12
阅读次数:
263