-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava1193.java
More file actions
46 lines (31 loc) · 823 Bytes
/
java1193.java
File metadata and controls
46 lines (31 loc) · 823 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
44
45
46
import java.util.Scanner;
public class java1193 {
public static void main(String[] args) {
Scanner k = new Scanner(System.in);
int num1 = k.nextInt();
int cnt = 0;
int a =0;
int b = 0;
int sum =0;
for (int i = 1; i < num1; i++) {
if (num1 < i){
i=num1-1;
b = num1-sum;
a=(cnt+1)-b;
System.out.println(a+"/"+b);
}
else {
if (i==num1){
b = num1-sum;
a=(cnt+1)-b;
System.out.println(a+"/"+b);
}
else{
num1 = num1 - i;
sum+=i;
cnt++;
}
}
}
}
}