#include<stdio.h>
int gcd(int a,int b);
int main()
{
    int n,m,a,b,i,sum;//sum是最小公倍数
    scanf("%d",&n);
       while(n--)
       {
              scanf("%d",&m);
              sum=1;//sum=1
              for(i=1;i<=m;i++)
              {
                scanf("%d",&b);
                sum=sum/gcd(sum,b)*b;
               }
               printf("%d\n",sum);
       }
     return 0;
}
int gcd(int a,int b)
{
    int temp;
    while(a%b)
    {
      temp=b;
      b=a%b;
      a=temp;  
    }
    return b;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
  • 2022-12-23
  • 2021-12-24
  • 2018-03-21
猜你喜欢
  • 2021-09-29
  • 2022-12-23
  • 2022-01-03
  • 2022-02-08
  • 2021-07-19
  • 2021-10-01
  • 2021-06-11
相关资源
相似解决方案