eolymp
bolt
Try our new interface for solving problems
Problems

Cantor Fractions

Cantor Fractions

In the late \textbf{XIX}-th century the German mathematician George Cantor argued that the set of positive fractions \textbf{Q^\{+\}} is equipotent to the set of positive integers \textbf{N}, meaning that they are both infinite, but of the same class. To justify this, he exhibited a mapping from \textbf{N} to \textbf{Q^\{+\}} that is onto. This mapping is just traversal of the \textbf{N}x\textbf{N} plane that covers all the pairs: \includegraphics{http://uva.onlinejudge.org/external/8/p880a.gif} The first fractions in the Cantor mapping are: \includegraphics{http://uva.onlinejudge.org/external/8/p880b.gif} Write a program that finds the \textbf{i}-th Cantor fraction following the mapping outlined above. \InputFile The inputs consists of several lines with a positive integer number \textbf{i} each one. \OutputFile The output consists of a line per input case, that contains the \textbf{i}-th fraction, with numerator and denominator separed by a slash (\textbf{/}). The fraction should not be in the most simple form.
Time limit 3 seconds
Memory limit 64 MiB
Input example #1
6
Output example #1
1/3