Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Mixed Fractions

Limits 1s, 512 MB

Given an improper fraction (as the numerator NN and the denominator DD), determine and print it in mixed fraction form.

Here are a few examples of improper and mixed fractions:

ImproperMixed
95 \frac{9}{5} 145 1\frac{4}{5}
32 \frac{3}{2} 112 1\frac{1}{2}
115 \frac{11}{5} 215 2\frac{1}{5}

Input

The input will contain two integers NN (1<N<1001 < N < 100) and DD (1<D<N1 < D < N).

All test cases will always produce a valid mixed fraction.

Output

Print three integers: the whole number, the numerator and the denominator of the mixed fraction, each separated by a space.

Sample

InputOutput
9 5
1 4 5

Discussion

Statistics


98% Solution Ratio

hasanakhiarEarliest, Nov '18

hasanakhiarFastest, 0.0s

akashmbstuLightest, 0 B

n4o847Shortest, 26B

Submit

Login to submit

Editorial

This problem requires some basic integer arithmetic: Let us consider NNN (the numerator) to be 9 and...

Related Contests

Toph uses cookies. By continuing you agree to our Cookie Policy.