标签:des style blog http color os io strong
Description
Input
Output
Sample Input
Sample Output
1 #include<stdio.h> 2 int gcd(int a,int b) 3 { 4 if(b==0) return a; 5 return gcd(b,a%b); 6 } 7 int main() 8 { 9 int t; 10 int n,a,b,i; 11 int cnt; 12 scanf("%d",&t); 13 while(t--) 14 { 15 scanf("%d",&n); 16 cnt=a=1; 17 for(i=1;i<=n;i++) 18 { 19 scanf("%d",&b); 20 cnt=a/gcd(a,b)*b; 21 a=cnt; 22 } 23 printf("%d\n",cnt); 24 } 25 return 0; 26 }
K - Least Common Multiple,布布扣,bubuko.com
标签:des style blog http color os io strong
原文地址:http://www.cnblogs.com/angledamon/p/3924037.html