Skip to content

Instantly share code, notes, and snippets.

@dalcon10028
Created January 21, 2020 12:46
Show Gist options
  • Select an option

  • Save dalcon10028/b02c3ae8abb348c527d5d45fe992ccc2 to your computer and use it in GitHub Desktop.

Select an option

Save dalcon10028/b02c3ae8abb348c527d5d45fe992ccc2 to your computer and use it in GitHub Desktop.
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