标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 44922 Accepted Submission(s): 16877
#include<iostream> #include<stdio.h> using namespace std; long long gcd(long long x,long long y) { long long a; if(x<y) a=x,x=y,y=a; while(y!=0) { a=x%y; x=y; y=a; } return x; } int main() { int t,n; long long tmp,end; scanf("%d",&t); while(t--) { scanf("%d",&n); end=1; for(int i=0;i<n;i++) { scanf("%I64d",&tmp); end=(tmp*end)/(gcd(tmp,end)); } printf("%I64d\n",end); } return 0; }
hdu 1019 Least Common Multiple
标签:
原文地址:http://www.cnblogs.com/superxuezhazha/p/5539794.html