Minimum Public multiple
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 2010 accepted submission (s): 1543
Problem description
Given two positive integers, calculate the minimum public multiples of these two numbers.
Input
The input contains multiple groups of test data. Each group has only one row, including two positive integers not greater than 1000.
Output
For each test case, the minimum public multiple of the two numbers is given, and each instance outputs a row.
Sample Input
10 14
Sample output
70
Source
Poj
Recommend
Eddy
1:# Include <iostream>
2:Using NamespaceSTD;
3:IntGcd (IntA,IntB ){
4:Return(B = 0? A: gcd (B, A % B ));
5:}
6:IntMain (){
7:For(IntN, m; CIN> N> m ;){
8:Cout <n/gcd (n, m) * m <'\ N';
9:}
10:}
Division of moving phase (also known as "EuclideanAlgorithm"):
Equality: gcd (a, B) = gcd (B, A % B );
Boundary Condition: gcd (A, 0) =;
The number of recursive layers of The GCD function cannot exceed 4.785lg (n) + 1.6723, where n = max {a, B };
It is worth mentioning that the maximum number of recursive layers of GCD is gcd (f (N), F (n-1), and F (n) is a series of Fibonacci;
(From Liu lujia's White Book, p117 );