HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51085 - xyx Divisible by k

Guest
• Review clarifications (2)

Section problems

• 51011 - Decoding the Path
• 50515 - Lines - Revisited
• 51088 - Number of letters
• 50913 - Manhattan Distance
• 51125 - Filling an Array 3
• 50824 - Sum of Group Maxes
• 50449 - The biggest result
• 51172 - The biggest Minute
• 51085 - xyx Divisible by k
• 51087 - Are they the same?
• 50442 - Polynomial Addition
• 51015 - Student Scholarships
• 50982 - A thief in labyrinth
• 51091 - Guess the number - 1
• 51008 - Sum of Regional Maxes
• 50989 - Rectangles and Points
• 51020 - Number of nodes removed

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 Ibrahim Mesecan.

xyx Divisible by k

Question: There's a number which contains only two given digits: x and y. Check if there's any at most 9-digit number which is divisible by k. For example, if you're given the digits 2 and 5; and the divisor 15, 225 is the smallest number divisible by 15. For example if you're given: the digits 3 and 6; and the divisor 12, 36 is the smallest number divisible by 12.

Input specification: You will be given two digits and a number (k). The digits are different than 0; and k is between 1 and 9999.

Output specification: Show the smallest number divisible by k. If there is no such number, show -1;

Sample Input Sample Output
2 3 6
222

Explanation: The following are not divisible by 6: 2; 3; 22; 23; 32; 33; So, 222 is the smallest number divisible by 6.



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

www.contester.ru