-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ1193.java
More file actions
30 lines (23 loc) · 707 Bytes
/
Copy pathJ1193.java
File metadata and controls
30 lines (23 loc) · 707 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
package TIL;
import java.util.Scanner;
public class J1193 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int totalNumber = 0;
int cnt = 0;
int num = scanner.nextInt();
while(true) {
totalNumber += cnt;
if (num <= totalNumber) {
if(cnt%2 ==0) {
System.out.println(num - (totalNumber - cnt) + "/" + ( totalNumber - num +1));
}
else {
System.out.println( (totalNumber - num +1) + "/" + (num - (totalNumber - cnt)));
}
return;
}
cnt++;
}
}
}