问题描述
When Deathmoon played MC game, he faced a math problem. When he found a ancient tomb and came in, he found two polynomials f(x) and g(x) no the wall, only did he calculate f(x) + g(x) correctly ...
分类:
其他好文 时间:
2014-05-10 09:57:54
阅读次数:
300
题意:
给你ABCD四个集合,集合中数的个数都为N(N
当然你可以尝试枚举所有的组合,绝对可以计算出结果,大概有N^4种吧,如果你有足够的时间还是可以算出来的,哈哈。
当然我不是用上面一种方法计算的,那样算肯定超时。 我的做法是求出所有a+b 到ab数组中, 和所有 c+d到cd数组中,然后排序,枚举每个ab,用二分在cd中查找有没有可能组成0。 有个问题就...
分类:
其他好文 时间:
2014-05-10 08:40:14
阅读次数:
278
题目大意:
给出m个询问,问【l,r】之间的和 ,求出有多少次询问不和之前的矛盾的。
思路分析:
用并查集记录当前节点到根节点的和。
#include
#include
#include
#include
#define maxn 222222
using namespace std;
int set[maxn];
int sum[maxn];
in...
分类:
其他好文 时间:
2014-05-07 07:35:05
阅读次数:
386
(1)首先选择一个路径用来存放arm-linux-gcc。我选用的是/h...
分类:
系统相关 时间:
2014-05-07 07:34:28
阅读次数:
388
题意:经典Nim游戏博弈,给你n堆牌,每堆a[i]张,每次能从一堆中取出任一张(不能为0),最后不能取者为输
问先手有几种取法保证他最后能获胜。
思路:让Nim_sum=0(a[1]^a[2]…………^a[n]=0)时则输,利用这个定理,对于第i堆a[i],除了第i堆,其它的
Nim_sum=k,如果a[i]>k,则先手从第i堆可以取a[i]-k张牌,让a[i]=k,最后a[i]^k...
分类:
编程语言 时间:
2014-05-07 06:13:32
阅读次数:
428
NYOJ 640 Geometric Sum...
分类:
其他好文 时间:
2014-05-06 15:20:32
阅读次数:
229
项目中用到了地图相关的东西,就把以前的demo搬了出来,结果发现直接运行之前的demo没有问题,在xcode5下新建项目再把代码粘贴过来就会提示
May 5 11:36:21 infomedia-iPod-touch TestLocation[1465] : CGBitmapContextCreate: unsupported parameter combination: 5 integer ...
分类:
移动开发 时间:
2014-05-06 15:17:46
阅读次数:
769
【Question】
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 zero.
Note:
Elements in ...
分类:
其他好文 时间:
2014-05-06 14:57:29
阅读次数:
318
这道题看似简单,其实很坑爹啊,动不动就是Time Limit Exceeded,
比如我下面这段TLE的代码,我感觉方法是对的,但是too
naive,算法复杂度到了O(N^2),自然就TLE了而且有一些小语法错误需要注意:for(runner=current+1;;)不能用>;一定所有的case都...
分类:
其他好文 时间:
2014-05-06 11:31:09
阅读次数:
405