IARCS home > OLYMPIAD > Archives
Output format next up previous
Next: About this document ... Up: Nearest fraction Previous: Input format

Output format

For each input fraction ${n}/{d}$, you have to print out a line containing the values ${u}/{v}$ and ${x}/{y}$ nearest to ${n}/{d}$ in $X$, where ${u}/{v} < {n}/{d} <
{x}/{y}$. Print out $u$, $v$, $x$ and $y$ as four integers, in that order, on a single line, separated by spaces. Thus, your output will consist of M lines overall, each containing 4 integers.

The correct output for the earlier sample input is shown below.


1 51 1 50
41 61 39 58


Note: Your program should not print anything other than these M lines, each consisting of 4 numbers. Please remove all diagnostic print statements before making your final submission. A program with extraneous output will be treated as incorrect!







Madhavan Mukund 2003-05-22


Copyright (c) IARCS 2003-2024;   Last Updated: 23 May, 2003