HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC - 2013-2014 > problem:


2013-05-40. 50553 - Divisible by m

IMPC - 2013-2014

Start: Mar.16.2013 at 12:00:00 PM
Finish: Mar.16.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 2013-04-30. 50337 - Exam Averages
• 2013-04-40. 50338 - Convert Into ...
• 2013-04-50. 50774 - Hot Potato
• 2013-04-70. 50296 - Total Discount...
• 2013-04-80. 50343 - The number of...
• 2013-04-90. 50332 - Variance of a ...
• 2013-05-10. 50552 - Casual shoes
• 2013-05-30. 50580 - Days passed
• 2013-05-40. 50553 - Divisible by m
• 2013-05-50. 50593 - Transporter
• 2013-12-10. 50352 - Selling Cows
• 2013-12-40. 50342 - 100 Factorial
• 2013-12-50. 50674 - Collecting Eggs
• 2013-Nov-01. 50328 - How far away
• 2013-Nov-02. 50347 - Selling Oranges
• 2013-Nov-05. 50354 - Intersecting ...

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