You are a "Problem Killer", you want to solve many problems.
Now you have problems, the -th problem's difficulty is represented by an integer ().
For some strange reason, you must choose some integer and (), and solve the problems between the -th and...
分类:
其他好文 时间:
2015-08-27 15:23:47
阅读次数:
193
题意:
求最大等差或等比数列的长度
思路:
开始用二分,WA暴了,后来发现我用的等差数列公式有问题
(a[i]+a[j])*(j-i+1)/2,等差数列一定满足这个公式,但满足这个公式的不一定是等差数列,我sb了。。。。。
还有就算等比数列a[i+1]/a[i] == a[i]/a[i-1],也是sb了,这个会引起精度丢失,应该a[i]^2 = a[i-1]*a[i+1];
…….
正...
分类:
其他好文 时间:
2015-07-31 21:58:13
阅读次数:
112
题意:求最长的连续的等差 或者 等比序列
思路: 暴力,输入的时候将它们的差和比分别存在两个数组中
ps:此题动不动就超时 很无语, 必须用传统的输入输出, 不能加mem, 如果wrong了
考虑下n==2时答案是否为2;
代码:
#include
#include
#include
#include
#include
#include
#include
#include ...
分类:
其他好文 时间:
2015-07-31 10:35:11
阅读次数:
131
今天才知道长度为1或2的数组,既符合等差数列又符合等比数列。。。。dp【0】的初值赋为1,之后其他项赋为2,直接扫一遍,找出最大值就好了还学到了一点:判断等比数列的时候用双精度(double)除法去做,避免数据太大的时候int爆了,这里WA了好久。。。(逃
#include
#include
#include
#include<algorithm...
分类:
其他好文 时间:
2015-07-30 21:32:20
阅读次数:
156