//数论,gcd & lcm相关
//该题有只有一个数据的测试组
#include <cstdio>
#include <iostream>

int gcd(int a, int b) {
return b ? gcd(b, a%b) : a;
}

int lcm(int a, int b) {
return a / gcd(a, b) * b;
}

int main() {
int t;
scanf ("%d", &t);
while (t--) {
int n, a, b, i;
scanf ("%d%d", &n, &b);
a = 1;
a = lcm(a, b);
for (i=1; i<n; ++i) {
scanf ("%d", &b);
a = lcm(a, b);
}
printf ("%d\n", a);
}
return 0;
}

 

相关文章:

  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-08-27
  • 2022-12-23
  • 2022-03-04
  • 2022-02-01
猜你喜欢
  • 2021-05-18
  • 2021-09-22
  • 2022-12-23
  • 2021-08-02
  • 2021-10-19
  • 2021-07-16
  • 2021-10-04
相关资源
相似解决方案