Problem B
Super Number
Input: Standard Input
Output: Standard Output
Time Limit: 3 Seconds
Don't you think 162456723 very special? Look at the picture
below if you are unable to find its speciality. (a | b means ‘b
is divisible by a’)
Given n, m (0 < n < m < 30), you are to find a m-digit positive integer X such that for every i (n <= i <= m), the first i digits of X is a multiple of i. If more than one such X exists, you should output the lexicographically smallest one. Note that the first digit of X should not be 0.
Input
For each test case, print the case number and X.
If no such number, print -1.
2 1
10 3 29 |
Case 1: 1020005640 Case 2: -1 |
Problemsetter:
Rujia Liu, Member of Elite Problemsetters' Panel
Special Thanks to:
Monirul Hasan (Alternate solution)
Shahriar Manzoor (Figure Drawing)