求n个数的最小公倍数,#includeint low(int x,int y){int a,b;a=x;b=y;while(a!=b){if(a>b)a=a-b;elseb=b-a;}return x*y/a;}main(){int m[100000],l,i;int n;while(scanf("%d",&n)!=EOF){for(i=0;i
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 01:46:40
求n个数的最小公倍数,#includeint low(int x,int y){int a,b;a=x;b=y;while(a!=b){if(a>b)a=a-b;elseb=b-a;}return x*y/a;}main(){int m[100000],l,i;int n;while(scanf("%d",&n)!=EOF){for(i=0;i
求n个数的最小公倍数,
#include
int low(int x,int y)
{
int a,b;
a=x;b=y;
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
return x*y/a;
}
main()
{
int m[100000],l,i;
int n;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i
求n个数的最小公倍数,#includeint low(int x,int y){int a,b;a=x;b=y;while(a!=b){if(a>b)a=a-b;elseb=b-a;}return x*y/a;}main(){int m[100000],l,i;int n;while(scanf("%d",&n)!=EOF){for(i=0;i
好纠结 原来 要用双精度
以下代码 可以ac
#include
int low(double x,double y)
{
int a,b,r,c;
if(x>y) {a=(int)x;b=(int)y;}
else {b=(int)x;a=(int)y;}
while(a%b)
{
r=a%b;
a=b;
b=r;
}
return x*y/(double)b;
}
int main()
{
double m[999],l;
int n,i;
while(scanf("%d",&n)!=EOF)
{
if(n>0)
{
for(i=0;i