Created
January 21, 2020 12:46
-
-
Save dalcon10028/b02c3ae8abb348c527d5d45fe992ccc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.math.BigInteger; | |
| import java.util.*; | |
| public class Main { | |
| public static void main(String args[]) { | |
| Scanner sc = new Scanner(System.in); | |
| int N = sc.nextInt(); | |
| BigInteger firstRing = new BigInteger(sc.next()); // 첫 번째 링 | |
| BigInteger[] num = new BigInteger[N-1]; | |
| for (int i=0; i<N-1; i++) // 나머지 링 | |
| num[i] = new BigInteger(sc.next()); | |
| sc.close(); | |
| for (BigInteger bi : num) { | |
| BigInteger gcd = firstRing.gcd(bi); | |
| System.out.println(firstRing.divide(gcd)+"/"+bi.divide(gcd)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment