Start: Jun, 28, 2019 08:42:00
2019杭州师范大学第一届程序设计竞赛新生赛
End: Jun, 28, 2019 11:42:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 76ms
Memory: 2380kB
In contest: 1276

#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<queue>
using namespace std;
const int maxn=1e5+9;
const int inf=0x3f3f3f3f;
typedef long long ll;
bool cmp(const ll &a,const ll &b){
	return a>b;
}
int main(){
    ll n,num[maxn];
    scanf("%lld",&n);
    for(ll i=1;i<=n;i++) scanf("%lld",&num[i]);
    sort(num+1,num+1+n,cmp);
    ll ans=0;
    for(ll i=2;i<=n;i++){
    	if(num[1]%num[i]==0) continue;
		else{
			ans=num[i];
			break;
		} 
	}
	printf("%lld\n",ans+num[1]);
	return 0;
}