IARCS home > OLYMPIAD > Archives
Input format next up previous
Next: Output format Up: Nearest fraction Previous: The problem

Input format

Each test input will consist of a sequence of values ${a}/{b}$ for which you have to find the nearest fractions in $X$. The input is given as follows.

The first line is an integer M, $0 < \texttt{M} \leq 500$, indicating the number of fractions in this input test sequence. This is followed by M lines of input, each containing a pair of integers $\texttt{N}$ and $\texttt{D}$ separated by a space, representing the numerator and denominator of the input fraction, respectively. You are guaranteed that $\texttt{D} \geq 100$ and $\gcd(\texttt{N},\texttt{D}) = 1$.

Here is what the input would look like if the sequence consisted of the two examples ${2}/{101}$ and ${322}/{479}$ discussed earlier.


2
2 101
322 479




Madhavan Mukund 2003-05-22


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