-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBAEKJOON_1193
More file actions
43 lines (31 loc) · 974 Bytes
/
BAEKJOON_1193
File metadata and controls
43 lines (31 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
int n =1; // 몇 번째 행인가??
int X = Integer.parseInt(br.readLine());
if(X==1){
System.out.println("1/1");
System.exit(0);
}
int i=2;
int sum=1;
while(true){
sum = sum+i; // sum =3
n++; //시작하자마자 2
//i =2
if(X <= sum) {
if (n % 2 == 0) {
System.out.println((X-sum+n)+"/"+(sum-X+1));
} else {
System.out.println((sum-X+1)+"/"+(X-sum+n));
}
break;
}
i++;
}
}
}