#P7617. [COCI 2011/2012 #2] KOMPIĆI
[COCI 2011/2012 #2] KOMPIĆI
Description
Given positive integers , find how many integer pairs satisfy the following conditions:
- .
- and share at least one common digit (the digit does not need to be in the same position).
Input Format
The first line contains a positive integer .
The next lines each contain a positive integer .
Output Format
Output one integer in a single line, representing the number of pairs that satisfy the condition.
3
4
20
44
1
4
32
51
123
282
4
Hint
Sample Explanation
In Sample 1, the pair that meets the requirement is .
In Sample 2, the pairs that meet the requirement are , , , .
Constraints
For of the testdata, , .
Notes
The scoring of this problem follows the original COCI settings, with a full score of .
This problem is translated from COCI2011-2012 CONTEST #2 T4 KOMPIĆI.
Translated by ChatGPT 5
京公网安备 11011102002149号