Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Wave Sort
#include<bits/stdc++.h> using namespace std; int main() { vector<int> a; int n; cin>>n; a.resize(n); for(int i=0;i<n;i++) {cin >> a[i];} sort(a.begin(),a.end()); for(int i=1;i<n-1;i+=2) { swap(a[i],a[i+1]); } for(int i=0;i<n;i++) { cout<<a[i]<<" "; } return 0; }
run
|
edit
|
history
|
help
0
задача new
cache 内存消耗
Rev Fact WIP
Zadanie Kolokwium 2013: Trójkąty i trójkąty
Quadratic Equation
Vectores - insertar ordenado e imprimir
Finding Ocean
FunTemp
point to a rvalue
CheckSymbolBalance