시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 16 | 0 | 0 | 0.000% |
NarmakSung has a hardware shop that makes new digit plates for house numbers. If a house number is 195, for example, he has to create one plate for digit 1, one for digit 9, and one for digit 5. But, the orders are not always that simple. He may get orders to make digit plates, for example, for all houses in one side of a street.
Since making several plates of the same digit costs much less than making all digits for each house one by one, he wants to know, for a big order he receives, how many of each digit plate he has to make.
The first number in the input line, t ( 1 ≤ t ≤ 10) is the number of orders. Following this, t orders are written in the input file. Each order starts with a line containing a street name, an arbitrary string of length at most 50 characters. The second line contains a single integer N ( 1 ≤ N ≤ 10), the number of sub-orders, followed by N lines of sub-orders. Sub-orders are of three kinds:
Note that if a house number is ordered more than once in two separate sub-orders, it is counted only once if it is not excluded at all (like number 100 in the second test case in the sample input). Also, if a house number is excluded somewhere in the test case, it cancels any order for that number, even if it appears later in the test case (like number 500 in the second sample). Note that it is possible to exclude some numbers that do not appear in other orders at all. In this case, these numbers are ignored (like 900 in the second sample).
One set of output data is written for each input order consisting of 13 lines. Each set starts with one line containing the street name exactly as appeared in the input order. The next line must be of the form `C addresses' where C is the total number of house numbers to be made. In the special case of C = 1, the output line should be `1 address'. The next 10 lines should be of the following form: Line i should contain the number of digit plates needed to be made for digit i. These 10 lines are on the format `Make X digit Y' where X is how many copies of digit Y they need to make. The last line states the total number Z of digits needed, on the format `In total Z digits'. If there is only one digit to produce, it should say, `In total 1 digit', in order to be grammatically correct. The output should be case-sensitive.
2 Azadi Street 2 + 101 103 2 275 Sharif Highway 3 100 - 500 900 100 + 100 800 100
Azadi Street 3 addresses Make 2 digit 0 Make 3 digit 1 Make 1 digit 2 Make 1 digit 3 Make 0 digit 4 Make 1 digit 5 Make 0 digit 6 Make 1 digit 7 Make 0 digit 8 Make 0 digit 9 In total 9 digits Sharif Highway 4 addresses
ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2003 A번