#include <stdio.h>
#define maxn 1000010
int max(int a, int b)
{
return a>b?a:b;
}
double a[maxn], d[maxn], q[maxn];
int main()
{
int t, n, i, res, ap, gp;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
for(i = 0;i < n;i++)
{
scanf("%lf", &a[i]);
if(i != 0)
{
d[i] = a[i] - a[i - 1];
q[i] = a[i] / a[i - 1];
}
}
res = 1, ap = 1, gp = 1;
for(i = 2;i < n;i++)
{
if(d[i] == d[i - 1]) ap++;
else ap = 1;
if(q[i] == q[i - 1]) gp++;
else gp = 1;
res = max(res, max(ap, gp));
}
if(n == 2) res = 2;
else if(n != 1) res++;
printf("%d\n", res);
}
}
HDU 5238 Problem Killer
最新推荐文章于 2018-12-14 23:45:44 发布