HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50553 - Divisible by m

Guest
• Review clarifications (2)

Section problems

• 50917 - Descending Numbers
• 51029 - Buy Three Items
• 51032 - Triangle Property
• 51033 - Sum of the series
• 51027 - Download Percentage
• 51028 - Isosceles Triangles
• 51031 - Convert from Hex to Dec
• 51030 - Number of Right Triangles
• 50553 - Divisible by m
• 50554 - nth power of m
• 50557 - nth Power of m (Long Multiply)
• 50559 - Prime Factors of a Number
• 50565 - Binary numbers
• 50568 - Body Mass Index Calculator
• 50571 - Armstrong Numbers - 2
• 50572 - Palindromic Numbers
• 50574 - Triangular Numbers

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.
Inspired from Mongolian Informatics O. Prepared by Ibrahim Mesecan.

Divisible by 2013

Shqip

We are given a number (num) which is composed of only one digit (d). The length of the number is not known, but it's known that the number contains only the same digit (d) and it's fully divisible by another number (m).

For example if the given digit is '1' and the number (m) is 3, the smallest number that contains only 1s as digit and is divisible by 3 contains three 1s (111).

Question:
Write a program that is going to find the number of digits in num where the number is perfectly divisible by m and the length of the number is the smallest.

Input specification
You will be given two integers: d and m where 1 ≤ d < 10 and 1 < m < 10000 .

Output specification
If there exists a result, give just one number that represents the number of digits in the result. Note that there will be always a result ≤ 2000. If the length exceeds 2000, show the message: "There is no such number"

Sample Input I
   5 7
Sample Output I
   6
 Sample Input II
   3 2
 Sample Output II
  There is no such number
 Sample Input III
   1 2013
 Sample Output II
  60

Output Explanation :
  Input 1: 555555 is perfectly divisible by 7 (555555 / 7 = 79365)
  Input 2: Because 3 is an odd number, no number composed of only 3s can be perfectly divisible by 2.
  Input 3: The number composed of only 1s must have at least sixty 1s as digit in order to be divisible by 2013.


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

www.contester.ru