We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main.java.com.poogle.PG.Q62048; public class Solution { public static void main(String[] args) { System.out.println(solution(8, 12)); } private static long solution(int w, int h) { long sum = (long) w * (long) h; long not = 0; long gcd = calGCD(w, h); if (gcd == 1) { not = w + h - 1; } else if (gcd > 1) { not = gcd * ((w / gcd) + (h / gcd) - 1); } return sum - not; } private static long calGCD(long a, long b) { if (a % b == 0) { return b; } return calGCD(b, a % b); } }
The text was updated successfully, but these errors were encountered:
26eb468
suhyunsim
No branches or pull requests
문제
핵심 아이디어
어려운 점, 실수
풀이
The text was updated successfully, but these errors were encountered: