[JAVA] 최대공약수, 최소공배수
·
Programming Language/JAVA
최대공약수 (GCD) private static long gcd(long a, long b) { if(a % b == 0) return b; return gcd(b, a%b); } public static int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a%b); } 최소공배수 (LCM) A * B / gcd(A, B) import java.io.*; import java.util.*; public class num13241 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sys..