主题:[讨论]这个题用动态规划怎么做?
我设计的状态是到第n个数为止的方案数,怎么转移啊?
Description
There are two numbers m and n, now Zero want to choose an consecutive part of m to form a new number p, so that p can be divide exactly by n. Could you write a program to calculate how many ways are there to choose p?
Input
Input will consist of multiple test cases.
For each case, there will be two numbers, m and n.
The number of m's digits is less than 10000, and there is no '0' in m. 1 &le n &le 100
Output
Output a single number, the ways to choose p.
Sample Input
22 2
111 1
111 2
123 3
Sample Output
3
6
0
3
Hints: in case "123 3",the ways to choose are "12","3","123"
有一些数据
111 1
123 3
135 5
22 2
6985924183 2
9387868941 3
1761587696 4
3131759284 5
3734734832 9
6
3
3
3
26
17
19
6
Description
There are two numbers m and n, now Zero want to choose an consecutive part of m to form a new number p, so that p can be divide exactly by n. Could you write a program to calculate how many ways are there to choose p?
Input
Input will consist of multiple test cases.
For each case, there will be two numbers, m and n.
The number of m's digits is less than 10000, and there is no '0' in m. 1 &le n &le 100
Output
Output a single number, the ways to choose p.
Sample Input
22 2
111 1
111 2
123 3
Sample Output
3
6
0
3
Hints: in case "123 3",the ways to choose are "12","3","123"
有一些数据
111 1
123 3
135 5
22 2
6985924183 2
9387868941 3
1761587696 4
3131759284 5
3734734832 9
6
3
3
3
26
17
19
6