您的位置:首页 > 其它

【杭电1108】最小公倍数

2016-07-24 20:33 218 查看
最小公倍数
Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d
& %I64u
Submit Status Practice HDU
1108

Description

给定两个正整数,计算这两个数的最小公倍数。
 

Input

输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.
 

Output

对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。 

 

Sample Input

10 14

 

Sample Output

70 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<cstdio>
int max(int a,int b)
{
if(a%b==0)
return b;
else
return max(b,(a%b));
}
int min(int a,int b)
{
return a*b/max(a,b);
}
int main()
{
int a,b,t;
while(scanf("%d%d",&a,&b)!=EOF)
{
t=min(a,b);
printf("%d\n",t);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: