import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
String question = kb.next();
String[] nums = question.split(":");
BigInteger[] bigIntegerNums = new BigInteger[2];
for(int i=0; i<2; i++) {
bigIntegerNums[i] = new BigInteger(nums[i]);
}
BigInteger gcd = bigIntegerNums[0].gcd(bigIntegerNums[1]);
StringBuilder sb = new StringBuilder();
sb.append(bigIntegerNums[0].divide(gcd)).append(":").append(bigIntegerNums[1].divide(gcd));
System.out.println(sb);
}
}
'공부기록 > 백준' 카테고리의 다른 글
[백준] 12931번 두 배 더하기 (0) | 2024.02.05 |
---|---|
[백준] 12871번 무한 문자열 (0) | 2024.02.04 |
[백준] 11399번 ATM (0) | 2024.02.04 |
[백준] 9996번 한국이 그리울 땐 서버에 접속하지 (0) | 2024.02.04 |
[백준] 11725번 트리의 부모 찾기 (0) | 2024.02.03 |