#P6371. [COCI 2006/2007 #6] V

    ID: 7151 远端评测题 1000ms 32MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2006O2优化数位 DPCOCI(克罗地亚)

[COCI 2006/2007 #6] V

Problem Description

Using the given digits, form some numbers in [A,B][A, B] such that each of these numbers is divisible by XX.

Input Format

The first line contains three integers X,A,BX, A, B.

The second line is a digit string, indicating the digits that can be used. A digit can be used multiple times, and the digits will not be repeated.

Output Format

Output one integer in one line, indicating how many numbers in [A,B][A, B] that can be formed using the given digits are divisible by XX.

2 1 20
0123456789
10
6 100 9294
23689
111
5 4395 9999999999
12346789
0

Hint

Constraints

  • For 100%100\% of the testdata, it is guaranteed that 1X<10111 \le X < 10^{11}, 1AB<10111 \le A \le B < 10^{11}.

Notes

This problem is translated from COCI2006-2007 CONTEST #6 T5 V

Translated by ChatGPT 5