Created
January 17, 2020 01:51
-
-
Save dalcon10028/dc69144f4af6e6dcb241e2856609e8d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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