#2994. Divisible Substring
0
Divisible Substring
Divisible Substring
题目描述
Takahashi 有一个长度为 的字符串 ,由数字 到 组成。 他很喜欢素数 。他想知道将 的多少个非空(连续)子字符串 —— 总共有 个 —— 当作十进制整数时能被 整除。 这里以 开头的子字符串也算数,并且来源于 不同位置的子字符串即使作为字符串或整数相同也被区分。 计算这个计数以帮助 Takahashi。
输入格式
Input is given from Standard Input in the following format:
输出格式
Print the number of non-empty (contiguous) substrings of that are divisible by when regarded as an integer written in base ten.
4 3
3543
6
4 2
2020
10
20 11
33883322005544116655
68
提示
consists of digits. is a prime number.这里 = 。共有十个非空(连续)子字符串:
:能被 整除。
:不能被 整除。
:能被 整除。
:能被 整除。
:不能被 整除。
:能被 整除。
:能被 整除。
:不能被 整除。
:不能被 整除。
:能被 整除。
其中六个能被 整除,所以输出 。
这里 = 。共有十个非空(连续)子字符串,全部都能被 整除,所以输出 。
注意以 开头的子字符串也算数。
标签: AtCoder|abc158E
来源
AtCoder|abc158E