forked from ngthanhtrung23/CompetitiveProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.java
More file actions
22 lines (21 loc) · 605 Bytes
/
A.java
File metadata and controls
22 lines (21 loc) · 605 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.io.*;
import java.util.*;
import java.math.*;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int sum = 0;
for(int b = 2; b < a; ++b) {
int t = a;
while (t > 0) {
sum += t % b;
t /= b;
}
}
BigInteger A = BigInteger.valueOf(sum);
BigInteger B = BigInteger.valueOf(a - 2);
BigInteger g = A.gcd(B);
System.out.println(A.divide(g) + "/" + B.divide(g));
}
}