Multiple of 2019
View as PDF
Submit solution
Points:
100
Time limit:
1.0s
PyPy 3
3.0s
Python 3
3.0s
Memory limit:
256M
Problem type
Given is a string consisting of digits from
1 through 9.
Find the number of pairs of integers with
such that the
substring from the
-th character through the
-th character of
, interpreted as a base
ten integer, is a multiple of
.
Input
The input consists of a single line containing .
Output
Print the number of pairs of integers that satisfy the condition.
Constraints
is a string consisting only of digits from
1through9
Example 1
Input
1817181712114
Output
3
Explanation
The valid pairs are ,
, and
.
Example 2
Input
14282668646
Output
2
Example 3
Input
2119
Output
0
Explanation
No pairs satisfy the condition.
Comments