[Codility] [12–1] ChocolatesByNumbersscore 100%)

【Lesson 12–1】: ChocolatesByNumbers 求最小公倍數(score 100%)

public static int ChocolatesByNumbers(int N, int M){return N / gcd(N, M);}public static int gcd(int A, int B){if (A % B == 0)return B;elsereturn gcd(B, A % B);}

--

--