标签:
1 #include<cstdio> 2 #include<cmath> 3 #include<iostream> 4 #include<cstring> 5 using namespace std; 6 int n,t; 7 long long nn,ans; 8 int gcd(long long x,long long y) 9 { 10 long long a; 11 a=x>y? x:y; 12 while(y!=0) 13 { 14 a=x%y; 15 x=y; 16 y=a; 17 } 18 return x; 19 } 20 int main(){ 21 scanf("%d",&n); 22 for(int i=1;i<=n;++i) 23 { 24 scanf("%d",&t); 25 ans=1; 26 for (int j=1;j<=t;++j) 27 { 28 scanf("%I64d",&nn); 29 ans=(ans*nn)/gcd(ans,nn); 30 31 } 32 printf("%d\n",ans); 33 } 34 return 0; 35 }
HDU 1019 Least Common Multiple 数学题
标签:
原文地址:http://www.cnblogs.com/fakerv587/p/5179118.html