#include <iostream>
#include <cstdio>
using namespace std;
int a[10010];
int gcd(int a, int b){ // 求a, b最大公约数;
return (b == 0 ? a : gcd(b, a%b));
}
int main()
{
int n;
while(scanf("%d", &n) != EOF){
for(int i = 0; i < n; ++i){
scanf("%d", &a[i]);
}
int t = a[0];
for(int i = 1; i < n; ++i){
int r = gcd(t, a[i]);
t = (t / r * a[i]); //依次求出最小公倍数;
}
cout << t << endl;
}
return 0;
}
hdu 2028
最新推荐文章于 2019-06-05 21:14:22 发布