fork(2) download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n, m;
  7. cin >>n;
  8. for(int i=0; i<n; i++) {
  9. cin >>m;
  10. int temp, ans;
  11. cin >>ans;
  12. for(int j=1; j<m; j++) {
  13. cin >>temp;
  14. ans = ans/__gcd(ans, temp)*temp;
  15. }
  16. cout <<ans <<endl;
  17. }
  18. }
Success #stdin #stdout 0s 4896KB
stdin
2
3 5 7 15
6 4 10296 936 1287 792 1
stdout
105
10296