#include<iostream>
using namespace std;
int gcd(int a,int b);
int lcm(int a,int b);
int main(void)
{
int n;
int temp;
int r;
while(cin>>n)
{
r=1;
while(n--)
{
cin>>temp;
r=lcm(temp,r);
}
cout<<r<<endl;
}
return 0;
}
int gcd(int a,int b)
{
int temp;
while(b)
{
temp=a%b;
a=b;
b=temp;
}
return a;
}
int lcm(int a,int b)
{
return a/gcd(a,b)*b;
}
2028 Lowest Common Multiple Plus
最新推荐文章于 2021-10-07 11:24:36 发布