Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Arban Uka.
Valid Permutations
A number is in valid permutation form, if all of its digits
appear just once. For example 12345 is in a valid permutation
form while 30480 is not. In 30480 the digit 0 appears twice and
it’s not a valid permutational number.
When a permutational number is multiplied with an integer,
the result usually yields another permutational number.
For example, if you multiply 12345 with a series of
integers from 1 to 10. you get the following:
12345 x 1 = 12345
12345 x 2 = 24690
12345 x 3 =
37035
12345 x 4 = 49380
12345 x 5 = 61725
12345 x 6 =
74070
12345 x 7 = 86415
12345 x 8 = 98760
12345 x 9 =
111105
12345 x 10 = 123450
3 of them are not valid permutational numbers
while the other 7 are valid permutational numbers.
Question:
Write a program that accepts two integers (num and k).
Your program will count the number of valid
permutational numbers from the multiplication
of the numbers from 1 to k.
Input specification
You will be given two integers (num and k) where
1 ≤ num ≤ 107 and 1 ≤ k ≤
200.
Note: The results are in integer limit.
Output specification
Show one number: number of valid permutational
numbers.
Sample Input I
12345 10
|
Sample Input II
12345 20
|
Sample Output I
7
|
Sample Output II
11
|
Для отправки решений необходимо выполнить вход.
|