출제 링크 : programmers.co.kr/learn/courses/30/lessons/62048
import java.math.BigInteger;
class Solution {
public long solution(int w, int h) {
int gcd = BigInteger.valueOf(w).gcd(BigInteger.valueOf(h)).intValue();
return ((long) w * (long) h) - ((((long) w / gcd) + ((long) h / gcd) - 1) * gcd);
}
}