2024-09-23 15:16
OLYMPIC SINH VIÊN CHUYÊN TIN 2023
PROBLEM20 CHỈ SỐ HẤP DẪN
The value of a numeric string S(|S|≤10^5) corresponding to a prime p is the number of distinct pairs of positions i,j where the number formed by characters from position i to j of S is divisible by p. Note that number may have leading zeros.
Given string S and prime p, for each query in q(q≤10^5) queries (each query is a pair L, R),output the value of substring L R.
Source:oj.vnoi.info/problem/olp_ct23_attindex
Hint:math,Mo's algorithm