codeforces round #201 Div2 A. Difference Row

OpenSoucre發表於2013-09-21
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n; ++ i ) cin >>a[i];
    sort(a.begin(),a.end());
    swap(a[0],a[n-1]);
    for(int i = 0 ; i < n; ++i) cout<<a[i]<<" ";
    cout<<endl;
    return 0;
}

 

相關文章