[Offer收割]编程练习赛39 register

Ended

Participants:163

Verdict:Accepted
Score:100 / 100
Submitted:2017-12-10 12:48:38

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll s[200005];
int main()
{
    cin>>n;
    for(int i=0;i<2*n;i++){
        scanf("%lld",s+i);
    }
    sort(s,s+2*n);
    ll ans=0;
    for(int i=1;i<n;i++) ans+=s[i];
    ans+=s[2*n-1];
    cout<<ans;
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX