Problem Description
Zhang is a software project manager, he led three development groups. Tight schedule today in overtime it. To boost morale, Zhang intends to send a bag of walnuts (rumored to be able to nourish the brain) to each group. His requirements are:
-
Number of walnuts each group must be the same
-
Each group must be equally Walnut (of course, not broken)
-
Try to provide a minimum number satisfying the condition of 1 (saving revolution Well)
Input format
input contains three positive integers a, b, c, represents the number of each group is overtime, separated by a space (a, b, c <30 )
output format
output a positive integer representing the number of bag walnut.
Sample Input 1
2. 4. 5
Sample Output 1
20 is
a sample input 2
. 3. 1. 1
Sample Output 2
. 3
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
if(a%b==0){
return b;
}else{
gcd(b,a%b);
}
}
int main(){
int a,b,c;
cin>>a>>b>>c;
int m = a*b/gcd(a,b);
cout<<m*c/gcd(m,c);
return 0;
}