Do you like fractions?
Time limit2sMemory limit256 MB
Convert each fraction to a mixed number by printing the quotient, the remainder, and the original denominator without reducing.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
You are writing the part of a basic math tutor that prints a fraction as a mixed number.
A proper fraction has a numerator smaller than its denominator. A mixed number splits off the whole part and writes what is left as a proper fraction. For a fraction with numerator and denominator , the whole part is the quotient and the numerator of the leftover fraction is the remainder . For example, becomes the whole part and the proper fraction .
Do not reduce the fraction. Printing in place of is wrong.
Input
The input has several lines, and each line is one test case. Each line holds two integers separated by a space. The first is the numerator and the second is the denominator . Both are between and .
Input ends on the line 0 0. That line is not a test case, so do not process it.
Output
For each test case, print the mixed number on one line. Print the whole part, the numerator of the leftover fraction, the character /, and the denominator, in that order, separated by single spaces.
Print a whole part of or a remainder of as it is. For numerator and denominator , print 0 3 / 4000. For numerator and denominator , print 25 0 / 98400.