您的位置:首页 > 其它

华东交通大学2016届新生选拔赛:1010 我是签到题

2016-12-11 16:57 363 查看


我是签到题


Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)


Total Submission(s) : 35   Accepted Submission(s) : 16


Font: Times New Roman | Verdana | Georgia


Font Size: ← →


Problem Description


Input

多组输入,每组输入三个正整数a,b,c(1<=a,b,c<=50000)。


Output

输出a,b,c三个数的最小公倍数。


Sample Input

1 2 3



Sample Output

6


代码:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#include<set>
#include<cmath>
#include<string>
using namespace std;

long long gcd(long long a, long long b){
long long temp;
while(b){
temp = a;
a = b;
b = temp % a;
}
return a;
}

int main(){
long long a, b, c, x;
while(~scanf("%lld %lld %lld", &a, &b, &c)){
x = a / gcd(a, b) * b;
printf("%lld\n", x / gcd(x, c) * c);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: