365A.md (928B)
1 Source: https://codeforces.com/problemset/problem/365/A 2 3 A. Good Number 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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*). 22 23 Input 24 25 The first line contains integers *n* and *k* (1 ≤ *n* ≤ 100, 0 ≤ *k* ≤ 9). The *i*-th of the following *n* lines contains integer *a**i* without leading zeroes (1 ≤ *a**i* ≤ 109). 26 27 Output 28 29 Print a single integer — the number of *k*-good numbers in *a*. 30 31 Examples 32 33 Input 34 35 ``` 36 10 6 37 1234560 38 1234560 39 1234560 40 1234560 41 1234560 42 1234560 43 1234560 44 1234560 45 1234560 46 1234560 47 ``` 48 49 Output 50 51 ``` 52 10 53 ``` 54 55 Input 56 57 ``` 58 2 1 59 1 60 10 61 ``` 62 63 Output 64 65 ``` 66 1 67 ```