http://acm.hdu.edu.cn/showproblem.php?pid=2028
做这个题目要注意时间的超时
02.#include<iostream>
03.using namespace std;
04.int gcd(int m, int n)
最小公倍数哦
05.{
06. while(n != 0)
07. {
08. int r = m % n;
09. m = n;
10. n = r;
11. }
12. return m;
13.}
14.int lcm(int m, int n)
15.{
16. int temp = gcd(m, n), result;
17. result = m / temp * n;
18. return result;
19.}
20.int main()
21.{
22. int n, m, result;
23. while(cin >> n){
24. result = 1;
25. for( int i = 0; i < n; i++)
26. {
27. cin >> m;
28. result = lcm(result, m);
29. }
30. cout << result << endl;
31. }
32. return 0;
33.}