题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5328
#include<stdio.h> #include<algorithm> typedef long long ll; ; ll a[MAXN]; int main() { int lgt; int T; int n; int tmp; int i; scanf("%d",&T); while(T--){ scanf("%d",&n); ; i < n; ++i){ scanf("%I64d",&a[i]); } ){ printf("2\n"); continue; } ){ printf("1\n"); continue; } lgt = ; tmp = ; ; i < n; ++i){ ] ) == ( a[i-] - a[i-] ) ){ tmp++; lgt = std::max(tmp,lgt); } else{ lgt = std::max(tmp,lgt); tmp = ; } } tmp = ; ; i < n; ++i){ ] ) == ( (] / (] ) ){ tmp++; lgt = std::max(tmp,lgt); } else{ lgt = std::max(tmp,lgt); tmp = ; } } printf("%d\n",lgt); } }