Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: COMPRESS
Description Reduce the number of digits.
An experimental physicist generates a great deal of data from experiments that he performs. The data generated from these experiments has a special property, and he wants to take advantage of this property to reduce the amount of space needed to store the results. The data is generated in pairs of numbers, where the first number is always less than the second number. The way that the physicist wants to store these numbers is similar to the how some people abbreviate a range of numbers in a book. For example, when they refer to pages 11 through 18 in a book, they will sometimes denote it as 11-8. Some notation definitions:
The rules for decoding the "compressed" second number are as follows:
Please note that leading zeros on the number C are significant. '7' is not the same as '07', and neither of them are the same as '007'. For example: given: "2839-06", then F=2839, C=06 so R would be 2906 Your task is to compute the "compressed" second number format from it's uncompressed version. Input In the input, each line of input will consist of a pair of non-negative integers separated by a hyphen, where the second number is always larger than the first number. The second number will always be less than 2 ^{31}-1.Output Each line of input will produce one line of output. Each line of output will consist of the first number, followed by a hyphen, followed by the "compressed" version of the second number. Sample Input 10-18 83294-84137 100-200 Sample Output 10-8 83294-137 100-00 Hint Q. Prob. 4 states that c will always be written with the min. digits. The example given as f=4137, c=223 gives r=4223. But if given 4137-4223 as input, the min. digits for c is 23. Are there test cases like this?
A. It is true that 4137-223 is not the smallest possible representation of the range 4137-4223, but, given 4137-223, the correct decompression is 4137-4223. A program that generated 4137-223 would be judged incorrect because 4137-23 is the shortest compressed representation of this range. Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator