import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int order = in.nextInt(); //order = 11
int line = 1; // 몇번째 대각선인지
int sum = 1; // 지금 대각선까지의 숫자개수의 합.
while(sum < order)
{
line++;
sum+=line;
} // line=2 sum=3 line=3 sum=6 line=4 sum=10 // order=11 line=5 sum=15
int indexInLine = order - (sum - line);
int x=0, y=0;
if (line % 2 ==0) //
{
x=indexInLine;
y= -order+sum+1;
}
else if ( line % 2 == 1) //지금 우리는 line=5,sum=15 이므로 라인이 홀수임!!! 우리의 order = 11; 5/1
{
x= -order+sum+1;
y=indexInLine;
}
/* [7] -> 1/4 [8] -> 2/3 [9] -> 3/2 [10] -> 4/1
*/
System.out.println(x+"/"+y);
}
} 지금까지 내가 푼 문제중에 로직이 제일 어려운 문제인 것 같다. line이라는 대각선과 sum이라는 지금 대각선까지에 있는 모든 수의 개수를 이용하여 분수를 구하는 문제이다. 이거는 분수라는 개념으로 들어가는 것이 아닌 대각선을 이용하여 x의값과 y의 값을 도출하여 푸는 문제였다. 나에겐 너무나도 생소한 문제이다. 무조건 다시 꼭 풀어봐야할 문제인 것 같다.