是我算法不对,还是笔记本CPU太差?我优化了两次,还是花了三四个小时来得到结果。在输出上加1就是最终结果。The
sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes
below two mil...
分类:
其他好文 时间:
2014-05-09 16:20:08
阅读次数:
295
Path Sum IGiven a binary tree and a sum,
determine if the tree has a root-to-leaf path such that adding up all the values
along the path equals the gi...
分类:
其他好文 时间:
2014-05-09 13:21:59
阅读次数:
320
题目描述N integers are arranged on a circle clockwise.
Given two integers M and K. For each position, you should take M continuous
integers on the left an...
分类:
其他好文 时间:
2014-05-09 10:30:49
阅读次数:
350
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 of ...
分类:
其他好文 时间:
2014-05-09 10:27:29
阅读次数:
449
1011:#include #include #include #include
#include using namespace std;const int maxN = 100001;const double eps = 1e-7;int
n;double m[maxN],sum[maxN];d...
分类:
其他好文 时间:
2014-05-09 08:36:06
阅读次数:
303
#includeusing namespace std;int main(){ int n =
0, sum; while (cin>>n) { sum = 0; // 这里要清零 for (int i =0; i <= n; i++)
{...
分类:
其他好文 时间:
2014-05-09 05:38:17
阅读次数:
241
http://acm.hdu.edu.cn/showproblem.php?pid=2236
找n个数使得这n个数都在不同的行和列里显然是二分图模型。难点在于求最大值与最小值差值最小。这里二分差值(看的题解),进行试探是否可以匹配成功。
#include
#include
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-05-09 02:39:47
阅读次数:
356
题目来源:HDU 3081 Marriage Match II
题意:
思路:
错误代码 纠结不知道哪错了 先放一放
#include
#include
#include
#include
#include
using namespace std;
const int maxn = 1010;
const int INF = 999999999;
struct Edg...
分类:
其他好文 时间:
2014-05-09 02:38:25
阅读次数:
264
我们有这么一张灰度图64*64
我们可以定义出4096个基,分别是某一位是0其他是1,在这种情况下,如果我们传输图片,那么就相当于传输原始数据
假设传到一半,网络坏了。
于是,我们得到
我们可以计算原图像和这图像的差距
error = I - I_approx;
distance = sqrt(sum(sum(error.*error)))
distance = ...
分类:
其他好文 时间:
2014-05-09 02:01:01
阅读次数:
287
题意:求长度不超过K的最大的连续序列的和
思路:采用单调队列,我们要求的是Max{sum[i]-sum[j]}(i-j#include
#include
#include
#include
using namespace std;
const int MAXN = 1000005;
const int INF = 0x3f3f3f3f;
int n,k;
int arr[MAXN],s...
分类:
其他好文 时间:
2014-05-09 01:57:07
阅读次数:
264