import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int mom = 1; // 분모
int son; // 분자
int x1 = x;
while(mom < x1) {
x1 -= mom;
mom++;
}
// mom : 대각선에 있는 분수 개수
// x1 : (mom이 홀수이면)왼쪽에서 or (mom이 짝수이면)오른쪽에서 몇번째에 위치하는지
if(mom % 2 != 0) { // 대각선에 있는 분수 개수가 홀수일 때
son = mom - x1 + 1;
mom = x1;
}
else { // 대각선에 있는 분수 개수가 짝수일 때
son = x1;
mom = mom - x1 + 1;
}
System.out.println(son + "/" + mom);
sc.close();
}
}
'Algorithm > 백준+프로그래머스+SWEA+정올+구름' 카테고리의 다른 글
[Algorithm] 백준 2609 최대공약수와 최소공배수 (0) | 2021.03.25 |
---|---|
[Algorithm] 백준 10870 피보나치 수 (0) | 2021.03.25 |
[Algorithm] 백준 10250 ACM 호텔 (0) | 2021.03.25 |
[Algorithm] 백준 2577 숫자의 개수 (0) | 2021.03.25 |
[Algorithm] 백준 2884 알람 시계 (0) | 2021.03.25 |