|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||64 MB||8||2||2||40.000%|
Mr. Random's job is to supply random numbers for people who comes to him. Unfortunately, generating a massive amount of random numbers is very hard. So, Mr. Random has decided to get a random number generator to help him.
The random number generator can generate a few million random numbers under 1 second. But Mr. Random has noticed that some of the number generated by the random number generator does not seem random to him so he need to filter all the numbers generated.
For a number to be random it must satisfy both the following conditions:
For example, if K = 2, then 111223344551, 111333555777 and 111 are all random, while 122221 (digit 2 is consecutively repeated 4 times) and 1234 (2 is a factor of 1234, which is not greater than K) are both not random.
Your task is to write a program to help Mr. Random to determine whether a number is random or not.
The first line of input contains two positive integers, N and K. The next N lines contain positive integers, one on each line. (1 ≤ N ≤ 10,000, 1 < K < 231)
The N positive integers are all less than 232. (Use unsigned int for storing the positive integers.)
Output N lines. Each line should be YES if the corresponding number is a random number or NO if the number is not a random number.
5 5 3 10 7 7777 121
NO NO YES NO YES
In the example above, K = 5.