取尺法

int L, R = 1, ans = 0;
for(L = 1; L <= n; L = R + 1) 
{ for(R = L; R + 1 <= n && B[L] == B[R + 1]; R++); ans = max(ans, R - L + 1); }
posted @ 2017-06-01 19:11  Aragaki  阅读(161)  评论(0编辑  收藏  举报