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: 64ms
Memory: 2108kB
In contest: 1276

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn=100100;
typedef long long ll;
int a[maxn];
ll temp;
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
	}
	sort(a,a+n);
	for(int i=n-2;i>=0;i--){
		temp=a[n-1]+a[i];
		if(temp%a[n-1]!=0&&temp%a[i]!=0){
			printf("%lld\n",temp);
			return 0;
		}
	}
	printf("%d\n",a[n-1]);
	return 0;
}