HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50413 - Valid Permutations

Guest
• Review clarifications (1)

Volume problems

• 50332 - Variance of a series
• 50398 - Sum of kth Anti-diagonal
• 50323 - Filtering Contact List
• 50400 - nth Row rth Element of a Table
• 50364 - Student averages
• 50410 - Zero Padding
• 50407 - Missing Number
• 50337 - Exam Averages
• 50413 - Valid Permutations
• 50861 - The largest Student Group
• 50406 - Draw Pattern 178
• 50419 - The longest bitonic sequence
• 50492 - Contest Scoreboard
• 50418 - Student averages
• 50420 - Teachers Sightseeing
• 50445 - Cryptography
• 50516 - Lines

Feedback

If you notice incorrect translations in Contester, please let author know.

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


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

www.contester.ru