题意:
给n个数,求它们的最小公倍数。
分析:
lcm(a,b)==a*b/gcd(a,b);
代码:
//poj 3970
//sep9
#include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{return a%b==0?b:gcd(b,a%b);
}
int main()
{int n;while(scanf("%d",&n)==1&&n){ll ans,x;scanf("%lld",&ans);--n;while(n--){scanf("%lld",&x);ans=ans*x/(gcd(ans,x));}if(ans>=1000000) puts("Too much money to pay!");else printf("The CEO must bring %lld pounds.\n",ans);}
}