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: 66ms
Memory: 1984kB
In contest: 1276

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
using namespace std;
typedef long long ll;
bool cmp(int a,int b)
{
	return a>b;
}
int gcd(int a,int b)
{
	return (b>0)?gcd(b,a%b):a;
}
int main()
{
	int n;
	int a[100010];
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1,cmp);
	int maxx=a[1];
	for(int i=2;i<=n;i++)
	{
		if(a[1]%a[i]!=0)
		{
			maxx=maxx+a[i];
			break;
		}
	}
	cout<<maxx<<endl;
	return 0;
}