A “nice number” is a number that starts with some repeating sequences 123456789 and followed by
some additional trailing zeroes:
input file consists of several data sets. The first line of the input file contains the number of data sets which is a positive integer and is not bigger than 20. The following lines describe the data sets.
Each data set consists of only one line which contains an integer N (1 < N < 106).
For each data set, write in one line the smallest multiple of N which is a nice number, or -1 if no such number exists.
1 342
1234567891234567890
Migrated from old NTUJ.
The ACM-ICPC 2010 Asia Regional Contest, Site Hanoi
No. | Testdata Range | Score |
---|