목록문제/백준_자바 (102)
sm 기술 블로그
import java.util.*; import java.io.*; class Main{ public static void main(String args[])throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList num = new ArrayList(); HashSet numSet = new HashSet(); int T = Integer.parseInt(br.readLine()); for(int i = 0; i< T; i++) { num.add(Integer.parseInt(br.readLine())); } Collections.sort(num); int numGCD = nu..
import java.util.*; import java.io.*; class Main{ public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int T = Integer.parseInt(br.readLine()); for(int i = 0; i < T; i++) { String[] sBits = br.readLine().split(" "); int x = Integer.parseInt(sBits[0]); int y = Integer.parseInt(s..
import java.util.*; import java.io.*; class Main{ public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sBits = br.readLine().split(" "); int x = Integer.parseInt(sBits[0]); int y = Integer.parseInt(sBits[1]); System.out.println(gcd(x,y)); System.out.println(lcm(x,y)); } static int gcd(int x, int y) { while(y..
import java.util.*; import java.io.*; class Main{ public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList num = new ArrayList(); br.readLine(); String[] sBits = br.readLine().split(" "); for(int i =0 ; i < sBits.length; i++) { num.add(Integer.parseInt(sBits[i])); } System.out.println(Collections.min(num)*Colle..