Solved by 210 users: ...
Time limit = 5
Memory limit = 8 Mb
The language to write down fractions consists of one simple rule.
means a fraction, with numerator "a" and denominator "b". Spaces are not allowed in this language.
In order to represent this fraction in text mode with fixed character width, the fraction line is build up from "minus" characters and placed in such way, that numerator is completely above and denumerator completely below the line. The numerator and denumerator should be placed according to this rule in such way, that the dimensions of the resulting fraction representation are minimal possible. Then two additional "minuses" are added to the fraction line one on the left and one on the right.
For example, the fraction
Has the following representation
The dimensions of fraction is this example are 11x7 characters.
Your task is to determine the horizontal and vertical size of the resulting fraction. You don't need to construct the fraction representation itself.
Input The first and only line contains the string with fraction specifiction. The length of te string does not exceed 50 characters.
Output Two numbers separated by one or more spaces the width and height of the fraction in characters respectively.
2 april 2004
<PREV | Problem set | Search related messages | NEXT>