#2012. [CEOI2010] Pin

[CEOI2010] Pin

题目描述

给出 nn 个长度为 44 的字符串,问有且仅有 dd 处不相同的字符串有几对。

输入格式

第一行:n,dn,d

以下 nn 行每行一个字符串。

输出格式

一个数:有多少对有且仅有处不相同的字符串。

4 1
0000
a010
0202
a0e2
0

样例说明 1

For these PINs each pair of PINs differs at more than one position.

4 2
0000
a010
0202
a0e2
3

样例说明 2

There are three pairs that differ at exactly 22 positions:

(0000,a010),(0000,0202),(a010,a0e2)(0000,a010),\\(0000,0202),\\(a010,a0e2)

数据规模与约定

对于 15%15\% 的数据,n2×103n \leq 2\times10^3

对于 30%30\% 的数据,d=1d=1

对于 60%60\% 的数据,d2d \leq 2

对于 75%75\% 的数据,字符串中只包含小写字母 afa\sim f 以及 090 \sim 9

对于 100%100\% 的数据,2n5×1042 \leq n \leq 5 \times 10^41d41 \leq d \leq 4,所有输入的字符串没有重复,串中的字符仅可能为 aza \sim z 或者 090 \sim 9

题目来源

鸣谢 sachs