ACM模版 字符串匹配 /* * hash(w[0 ... m - 1]) = * (w[0] * 2 ^ (m - 1) + ... + w[m - 1] * 2 ^ 0) % q; * hash(w[j + 1 ... j + m]) = * rehash(y[j], y[j + m], hash(w[j ... j + m - 1]); * rehash(a, b, h) = ((h - a * 2 ^ (m - 1)) * 2 + b) % q; * 可以用q = 2 ^ 32简化%运算 */ #define REHASH(a, b, h) (((h -...