1108 最小公倍数
来源:互联网 发布:非农数据分析软件 编辑:程序博客网 时间:2024/06/11 21:48
#include<stdio.h>
int gcd(int a,int b)
{
if(a<b)
{
int tmp=a;
a=b;
b=tmp;
}
if(b==0)
return a;
else
return gcd(b,a%b);
}
int gbs(int a,int b)
{
return a*b/gcd(a,b);
}
int main()
{
int a,b;
while(scanf("%d %d",&a,&b)==2)
{
printf("%d/n",gbs(a,b));
}
}
int gcd(int a,int b)
{
if(a<b)
{
int tmp=a;
a=b;
b=tmp;
}
if(b==0)
return a;
else
return gcd(b,a%b);
}
int gbs(int a,int b)
{
return a*b/gcd(a,b);
}
int main()
{
int a,b;
while(scanf("%d %d",&a,&b)==2)
{
printf("%d/n",gbs(a,b));
}
}
- 1108 最小公倍数
- 1108: 最小公倍数
- 1108 最小公倍数
- [1108]:最小公倍数
- 1108 最小公倍数
- hdu 1108 最小公倍数(最大公约数、最小公倍数)
- HDOJ 1108: 最小公倍数
- hdu 1108 最小公倍数
- HDU 1108 最小公倍数
- 杭电1108 最小公倍数
- 杭电1108 最小公倍数
- 杭电1108//最小公倍数
- HDU 1108 最小公倍数
- HDU 1108 最小公倍数
- hdu-1108 最小公倍数
- UVa 1108 最小公倍数
- hdu 1108 最小公倍数
- HDU 1108 最小公倍数
- 1061 Rightmost Digit
- 1071 The area
- 1085 Holding Bin-Laden Captive!
- 2008 October 20th Monday (十月 二十日 月曜日)
- 1086 You can Solve a Geometry Problem too
- 1108 最小公倍数
- 2008 October 21th Tuesday (十月 二十一日 火曜日)
- 1115 Lifting the Stone
- Objective-C
- 2008 October 23th Thursday (十月 二十三日 木曜日)
- 1170 Balloon Comes!
- 2008 October 24th Friday (十月 二十四日 金曜日)
- 2008 October 27th Monday (十月 二十七日 月曜日)
- 1235 统计同成绩学生人数