#P8712. [蓝桥杯 2020 省 B1] 整数拼接
[蓝桥杯 2020 省 B1] 整数拼接
Problem Description
You are given an array of length . You may choose two numbers and (), then concatenate and in order to form a new integer. For example, 12 and 345 can be concatenated into 12345 or 34512. Note that swapping the order of and is always considered as different ways of concatenation, even when .
Please compute how many concatenations result in an integer that is a multiple of .
Input Format
The first line contains integers and .
The second line contains integers .
Output Format
Output one integer representing the answer.
4 2
1 2 3 4
6
Hint
For all test cases, , , and .
Lanqiao Cup 2020, First Round Provincial Contest, Group B, Problem I.
Translated by ChatGPT 5