#include<fstream>
using namespace std;
ifstream fin("date.in");
ofstream fout("date.out");
int main()
{
int i,n,a[100];
fin>>n;
for(i=1;i<=n;i++) fin>>a[i];
for(i=1;i<n;i++)
if(a[i]>a[i+1])
{ int aux=a[i];
a[i]=a[i+1];
a[i+1]=aux;
if(i>1)i=i-2;
}
for(i=1;i<=n;i++) fout<<a[i]<<" ";
fin.close();
fout.close();
return 0;
}
|