标签:
1 #include<iostream> 2 using namespace std; 3 4 long long gcd(long long a, long long b) { 5 int c = a%b; 6 if (!c) 7 return b; 8 a = b, b = c; 9 gcd(a, b); 10 } 11 int main() { 12 int n; 13 while ((cin>>n)&&n) 14 { 15 long long num[1000]; 16 for (int i = 0;i < n;i++) 17 cin >> num[i]; 18 for (int i = 0;i < n - 1;i++) 19 num[i + 1] = num[i]*num[i+1]/gcd(num[i], num[i + 1]); 20 cout << num[n - 1] << endl; 21 }23 return 0; 24 }
杭电acm2029-Palindromes _easy version
标签:
原文地址:http://www.cnblogs.com/wuyoucao/p/4899352.html