1. 

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem 880 Cantor Fractions
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=10&page=show_problem&problem=821
*
* @author Miesel Christoph
* @author Seilbeck Robert
* @author Wolfram Andre
* @version X.0, 03/30/2009
*
* Status : Accepted
* Runtime: 1.360
*/

import java.io.BufferedInputStream;
import java.io.PrintWriter;
import java.util.Scanner;

class Main {
public static long[] getTerm(long n) {
long[] returnValue = new long[2];
long k, m;

/*************************************************************
* Doina-Logofatu-Algorithmen-C++, S. 67: Hier wird ohne Schleifen die * korrekte
* Zeilennummer ermittelt und in k gespeichert *
*************************************************************/

k = (long) Math.ceil(((Math.sqrt((double) (8 * n + 1)) - 3) / 2)) + 1;

/**********************************************************
* Hilfsgröße m für die Berechnung von Zähler und Nenner *
**********************************************************/

m = (long) (n - k * (k - 1) / 2);

returnValue[0] = k + 1 - m;
returnValue[1] = m;

return returnValue;
}

public static void main(String[] args) throws Exception {

BufferedInputStream bin = new BufferedInputStream(System.in);
PrintWriter w = new PrintWriter(System.out);
Scanner s = new Scanner(bin);
long value = -1;
long[] rockingValues = new long[] { 0, 0 };

while (s.hasNextLong()) {
value = s.nextLong();
rockingValues = getTerm(value);
w.println(rockingValues[0] + "/" + rockingValues[1]);

}
w.flush();
}
}

2.

/**
* Angewandte Mathematik SS 09
880 Cantor Fractions
* UVa Status: Accepted
* Run Time: 0.180
* Programming Language: C
* @author Doina Logofatu logofatu@hm.edu
*/

#include <stdio.h>
#include <math.h>

int main(){

long long n, k, m;

while (scanf("%lld", &n)==1)
{
k = (long long)ceil(((sqrt((double)(8*n+1))-3)/2))+1;

m = (long long) (n - k * (k - 1) / 2);

printf("%lld/%lld\n", k+1-m, m);
}

return 0;
}