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

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


50413 - Valid Permutations

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

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

• 50404 - Sum of Self Powers
• 50295 - Weighted Average
• 50343 - The number of Ending Zero...
• 50296 - Total Discount Rate
• 50289 - Monthly Allowance
• 50403 - Number of Chairs
• 50408 - Molecules
• 50481 - Car Parking
• 50413 - Valid Permutations
• 50412 - K numbers
• 50417 - Fun Fair
• 50433 - Sum of Cubes
• 50807 - Euro to Leke
• 50871 - Harmonic Mean
• 50521 - Pound to Grams
• 50292 - Average of 4 Marks
• 50432 - Numbers and Squares

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

Если у вас есть предложения или пожелания по работе 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