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: 65ms
Memory: 2572kB
In contest: 1276


#include <cstdio>
#include <algorithm>
#include <iostream>
#include<cstring>
#include<cmath>
#include<cstring>
using namespace std;
const int maxn=100005;
int f(int a) 
{ 
	int flag=1;
	int b=pow(a,0.5);
	for(int i=2;i<=b;i++)
	{
		if(a%i==0)flag=0;
	}
	return flag;
}
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	long n,i;
	long long a[maxn],maxx;
	scanf("%ld",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+n+1,cmp);
	maxx=a[1];
	for(i=2;i<=n;i++)
	{
			if(a[1]%a[i]!=0&&a[1]+a[i]>maxx)
				maxx=a[1]+a[i];
	}
	printf("%lld\n",maxx);

}