比如:353, 54545,数字都是交替出现的:
bool alternate = true; for (int i = 0; i < M.size(); ++i){ if (M[i] != M[i%2]) alternate = false; }