Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=5328
1#include <stdio.h>2#include <algorithm>3typedefLong Longll;4 Const intMAXN = 1e6+Ten;5 ll A[MAXN];6 intMain ()7 {8 intLgtintT;9 intNinttmp;Ten inti; Onescanf"%d",&T); A while(t--){ -scanf"%d",&n); - for(i =0; I < n; ++i) { thescanf"%i64d",&a[i]); - } - if(n = =2 ){ -printf"2\n"); + Continue; - } + if(n = =1){ Aprintf"1\n"); at Continue; - } -LGT =2; -TMP =2; - for(i =2; I < n; ++i) { - if((A[i]-a[i-1]) = = (a[i-1]-a[i-2] ) ){ intmp++; -LGT =Std::max (TMP,LGT); to } + Else{ -LGT =Std::max (TMP,LGT); theTMP =2; * $ }Panax Notoginseng } -TMP =2; the for(i =2; I < n; ++i) { + if( ( (Double) A[i]/(Double) a[i-1] ) == ( (Double) a[i-1] / (Double) a[i-2] ) ){ Atmp++; theLGT =Std::max (TMP,LGT); + } - Else{ $LGT =Std::max (TMP,LGT); $TMP =2; - } - } theprintf"%d\n", LGT); - }Wuyi}
Hdoj 5328 Problems Killer