3421.Good Number

Time Limit: 1s Memory Limit: 256MB

Let's call a number k-good if it contains all digits not exceeding k (0,...,k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a).

Input Format(From the terminal/stdin)

The first line contains integers n and k (1 \le n \le 100, 0 \le k \le 9). The i-th of the following n lines contains integer ai without leading zeroes (1 \le ai \le 109).

Output Format(To the terminal/stdout)

Print a single integer - the number of k-good numbers in a.

Sample Input 1

Copy
10 6
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
  · \n
       \n
       \n
       \n
       \n
       \n
       \n
       \n
       \n
       \n
       \n

Sample Output 1

Copy
10
  \n

Sample Input 2

Copy
2 1
1
10
 · \n
 \n
  \n

Sample Output 2

Copy
1
 \n

Submit

请先 登录

© 2025 FAQs