#include <iostream> using namespace std; int main(){ int n; while (cin >>n){ int a[2*n-1]; for (int i=0;i<=2*n-2;i+=2){ cin >>a[i]; } for (int i=0;i<=2*n-2;i+=2){ int min=a[i],tem; for (int j=i;j<=2*n-2;j+=2){ if (min>a[j]){ min=a[j]; a[j]=a[i]; a[i]=min; } } } for (int i=0;i<=2*n-2;i+=2){ cout <<a[i] <<' '; } cout <<endl; } return 0; }
#include using namespace std; int main(){ int n; while (cin >>n){ int a[2*n-1]; for (int i=0;i<=2*n-2;i+=2){ cin >>a[i]; } for (int i=0;i<=2*n-2;i+=2){ int min=a[i],tem; for (int j=i;j<=2*n-2;j+=2){ if (min>a[j]){ min=a[j]; a[j]=a[i]; a[i]=min; } } } for (int i=0;i<=2*n-2;i+=2){ cout <<a[i] <<' '; } cout <<endl; } return 0; }