标签:des style blog http io ar color os sp
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 34980 Accepted Submission(s): 14272
1 #include<iostream> 2 #include<stdio.h> 3 using namespace std; 4 typedef __int64 inta; 5 inta gcd(inta a,inta b) 6 { 7 if(b==0) 8 return a; 9 return gcd(b,a%b); 10 } 11 inta lcm(inta a,inta b) 12 { 13 return a*b/gcd(a,b); 14 } 15 int main() 16 { 17 int n; 18 while(cin >> n) 19 { 20 __int64 a; 21 __int64 vis=1; 22 while(n--) 23 { 24 scanf("%I64d",&a); 25 vis = lcm(vis,a); 26 } 27 printf("%I64d\n",vis); 28 } 29 return 0; 30 }
hdu 2028 Lowest Common Multiple Plus(最小公倍数)
标签:des style blog http io ar color os sp
原文地址:http://www.cnblogs.com/xuesen1995/p/4111900.html