package SearchFraction;

import java.util.Scanner;

public class Main {

	public static boolean isIn(int sum, int n) {
		if (sum >= n) {
			return false;
		} else
			return true;
	}

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int sum = 0;
		int i;
		for (i = 1; isIn(sum, N); i++) {
			sum += i;
		}

		int a, b;

		if (i % 2 == 1) {
			a = N - (sum - (i - 1));
			b = (i) - a;
		} else {
			b = N - (sum - (i - 1));
			a = (i) - b;
		}
		System.out.println(a + "/" + b);
	}
}

예제

 

+ Recent posts