Problem Description
Lele now is thinking about a simple function f(x).If x = 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x-3) + …… + a9 * f(x-10);
And ai(0<=i<=9) can only be 0...
分类:
其他好文 时间:
2015-03-11 21:44:50
阅读次数:
145
题意:When given an array(a0,a1,a2,?an?1)and an integerK, you are expected to judge whether there is a pair(i,j)(0≤i≤j st;ll ans,K;int n;int T;ll a[10000...
分类:
其他好文 时间:
2015-03-11 21:20:46
阅读次数:
143
http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?pid=1002&cid=570给定一个数组(a0,a1,a2,?an?1)和一个整数K, 请来判断一下是否存在二元组(i,j)(0≤i≤j#include#include#in...
Problem Description
When given an array (a0,a1,a2,?an?1) and an integer K, you are expected to judge whether there is a pair (i,j)(0≤i≤j/***************************************************************...
分类:
其他好文 时间:
2015-03-08 23:08:00
阅读次数:
454
呃。。其实挺水的一题,不说了。。伤心。。这题应该是要分开奇偶性的,因为如果不分开,当a0+...+ai=0,a(i+1)+....+aj=K时,求出来会出错。维护两种前缀和,sum=a0-a1+a2......aisum=-a0+a1-a2.....ai维护两个HASH,第一种前缀和当i为奇数时加入...
分类:
其他好文 时间:
2015-03-08 18:33:52
阅读次数:
111
下面这个网址就帮咱们实现了QQ提醒的功能,别被它的外面吓坏,虽然是长的有点恶心,但是它可是一段“神奇代码”。http://qzs.qq.com/snsapp/app/bee/widget/open.htm?content=15%E5%A4%A9%E5%B8%A6%E4%BD%A0%E4%BB%8Ec...
分类:
其他好文 时间:
2015-03-08 10:26:40
阅读次数:
192
传送门:Negative and Positive (NP)题意:给定一个数组(a0,a1,a2,?an?1)和一个整数K, 请来判断一下是否存在二元组(i,j)(0≤i≤j#include #include #include #include #include #include #include ...
分类:
其他好文 时间:
2015-03-08 00:05:47
阅读次数:
214
一直研究到现在。。。很神奇的一个问题。我var a=0 然后接着写代码下去,var a = 0;var b;$(".qhan ul li.next").click(function(){ (a0)?(a--):(a=2); b=a*(-320)+"px"; $(".bg ul")....
分类:
其他好文 时间:
2015-03-07 06:09:39
阅读次数:
116
一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M>=0)个位置,即将A中的数据由(A0A1……AN-1)变换为(AN-M …… AN-1 A0 A1……AN-M-1)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移...
分类:
编程语言 时间:
2015-03-05 12:36:19
阅读次数:
281
题目链接:Pow(x, n)
Implement pow(x, n).
这道题的要求是实现pow(x, n)函数。
求x的n次幂。直接的暴力思路,将x乘以自身n次即可,时间复杂度O(n)。当n非常大时,计算时间过长。
考虑将n转化为二进制数,即n = a0*2^0 + a1*2^1 + a2*2^2 + ... + an*2^n。而求x的n次幂,即为x^n = x^(a0*2^0 + a1...
分类:
其他好文 时间:
2015-03-04 11:09:43
阅读次数:
118