2017.08.29
최대공약수 (The Greatest Common Denominator(GCD)), 최소공배수(The Least(Lowest) Common Multiple(LCM))
*최대공약수 (The Greatest Common Denominator(GCD)), 최소공배수(The Least(Lowest) Common Multiple(LCM)) # Algorithm 1 : 간단한 방법(Simple Way)을 이용한 최대공약수(GCD) 구하기 1 2 3 4 5 6 int min(int a, int b) { if (a > b) return b; else if (a =1; g--) if ((m % g == 0) && (n % g == 0)) return g; } Colored by Color Scripter cs # Algorithm 2 : 유클리드 호제법(Euclidean Algorithm)을 이용한 최대공약수(GCD) 구하기 1 2 3 4 5 6 7 8 9 10 11 12 13 14..