Files
luogu/P8712.md
T
hanyixuanten fc217aeee6
Check cpp / md pair / Check md headers (push) Failing after 0s
new file: P8712.cpp
2026-10-21 13:20:41 +00:00

38 lines
879 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# P8712 [蓝桥杯 2020 省 B1] 整数拼接
## 题目描述
给定一个长度为 $n$ 的数组 $A_1,A_2,\cdots,A_n$。你可以从中选出两个数 $A_i$ 和 $A_j$($i\neq j$),然后将 $A_i$ 和 $A_j$ 一前一后拼成一个新的整数。例如 `12` 和 `345` 可以拼成 `12345` 或 `34512`。注意交换 $A_i$ 和 $A_j$ 的顺序总是被视为 $2$ 种拼法,即便是 $A_i=A_j$ 时。
请你计算有多少种拼法满足拼出的整数是 $K$ 的倍数。
## 输入格式
第一行包含 $2$ 个整数 $n$ 和 $K$。
第二行包含 $n$ 个整数 $A_1,A_2,\cdots,A_n$。
## 输出格式
一个整数代表答案。
## 输入输出样例 #1
### 输入 #1
```
4 2
1 2 3 4
```
### 输出 #1
```
6
```
## 说明/提示
对于所有评测用例,$1\le n\le10^5$,$1\le k\le10^5$,$1\le A_i\le10^9$。
蓝桥杯 2020 第一轮省赛 B 组 I 题。