ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Арифметика > задача:


50413 - Valid Permutations

Гость
• Вопросы к жюри (1)

Задачи раздела

• 50267 - Interesting permutations
• 50424 - Area
• 50372 - Number Quadruplets
• 51007 - Function f(x)
• 50413 - Valid Permutations
• 50481 - Car Parking
• 50417 - Fun Fair
• 50530 - Sum of Ratios
• 50384 - Permutations revisited
• 50368 - Right-most non zero digit in N!
• 50369 - Base Conversion
• 50407 - Missing Number
• 51003 - Double Prime

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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


Для отправки решений необходимо выполнить вход.

www.contester.ru