题目1439:Least Common Multiple
#include <cstdio>
int gcd(long long a,long long b){
if(b==0)return a;
else gcd(b,a%b);
}
int main(){
int n;
while(scanf("%d",&n)!=EOF){
while(n--){
int m;
scanf("%d",&m);
long long a,b;
scanf("%lld",&a);
m--;
while(m--){
scanf("%lld",&b);
a=a*b/gcd(a,b);
}
printf("%lld\n",a);
}
}
return 0;
}
注意题中所说的32-bit integer, 是unsigned