1052 - Repetitive Multiple

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 93

Solved: 33

Description
An integer is said to be repetitive if it can be written as a

concatenation of several copies (at least two) of another non-zero

-leading integer. For example, 11, 123123, 454545 are all

repetitive integers.

Since zero-leading integers are not allowed, 101 can not be

considered as 0101. Therefore, 101 is not repetitive.

Given a positive integer n, what is the smallest repetitive integer

which is a multiple of n.
Input
The input begins with an integer N (≤ 100) which indicates the

number of test cases followed. Each of the following test cases

consists of a positive integer n, where n will be less than 10^9.
Output
For each test case, print out the smallest repetitive multiple of n

in a single line.
sample input
5
7
101
123
999999
6339673
sample output
77
1010
33333
999999
114114114
hint
source
© 2015 HUST ACMICPC TEAM. All Right Reserved.