[恢]hdu 2028
2011-12-16 04:45:58
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2028
题意:中文。
代码:
# include <stdio.h>
int gcd(int a, int b){return a%b?gcd(b,a%b):b;}
int lcm(int a, int b){return a/gcd(a,b)*b;}
int main ()
{
int n, num, ans ;
while (~scanf ("%d", &n))
{
ans = 1 ;
while (n--)
{
scanf ("%d", &num) ;
ans = lcm(ans, num) ;
}
printf ("%d\n", ans) ;
}
return 0 ;
}