int gcd(int x,int y)
{
int t;
while(y)
{
t=x%y;
x=y;
y=t;
}
return x;
}
int lcm(int x,int y)
{
return x/gcd(x,y)*y;
}
int main(void)
{
int n,i,m,j,s,x;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&m);
s=1;
for(j=1;j<=m;j++)
{
scanf("%d",&x);
s=lcm(s,x);
}
printf("%d\n",s);
}
return 0;
}
在这里插入代码片
10-29
2622
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-28