Skip to content

Instantly share code, notes, and snippets.

@dalcon10028
Created January 17, 2020 01:51
Show Gist options
  • Select an option

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

Select an option

Save dalcon10028/dc69144f4af6e6dcb241e2856609e8d1 to your computer and use it in GitHub Desktop.
import java.math.BigInteger;
import java.util.*;
class Solution {
public static int gcd(int a, int b){
BigInteger b1 = BigInteger.valueOf(a);
BigInteger b2 = BigInteger.valueOf(b);
return b1.gcd(b2).intValue();
}
public long solution(int w,int h) {
long cutOfcircle = w+h-gcd(w, h); // 잘린 사각형
long answer = (long)w*h-cutOfcircle;
return answer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment