mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 100819Q.cpp
This commit is contained in:
parent
361adb1807
commit
be702512ae
29
Codeforces/Gym/100819Q.cpp
Normal file
29
Codeforces/Gym/100819Q.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
/// Problem Q -Excellence
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <algorithm>
|
||||
using namespace std;
|
||||
|
||||
#define MAXN 100005
|
||||
#define INF 0x3f3f3f3f
|
||||
int pool[MAXN];
|
||||
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d",&pool[i]);
|
||||
}
|
||||
sort(pool,pool+n);
|
||||
int ans=INF;
|
||||
for(int i=0,j=n-1;i<j;i++,j--)
|
||||
{
|
||||
ans=min(ans,pool[i]+pool[j]);
|
||||
}
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user