Length String
Time limit3sMemory limit1024 MB
Given a and b, output the length string of length a times 10 to the power b, printing only the first 17 characters when that length is at least 21.
- Level
Hard8 of 10
- Topics
- String, Math, Implementation
- Solved
- No attempts yet
Problem

A length string is a string made only of the digits 0 to 9 and hyphens ('-') that meets the following conditions.
- Two or more hyphens do not appear in a row.
- The first character is not '0'.
- The last character is not '-'.
- The digit '0' does not come right after a hyphen.
- Read as a base-10 number, the longest suffix made only of digits equals the length of the string. If that suffix is empty, it is read as 0.
- If the string contains a hyphen, the length string is the substring from the start up to the last hyphen.
For every non-negative integer , there is exactly one length string of length . The following are length strings of lengths , , and .
1-3-5
-2-4-6-8
1-3-5-7-10-13
Given a positive integer and a non-negative integer , find the length string of length .
Input
The first line contains the number of test cases . ()
Each test case is given on one line with two integers and , separated by a space. (, )
Output
For each test case, print the length string of length . If , print only the first 17 characters, in the same format as the example.