Cod sursa(job #1047581)
Utilizator | Data | 4 decembrie 2013 18:34:14 | |
---|---|---|---|
Problema | Sortare prin comparare | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include<fstream>
# define mod 1999999973
using namespace std;
ifstream f("algsort.in");
ofstream g("algsort.out");
int i,n,a[500001],j;
int main()
{
f>>n;
for(i=1;i<=n;i++) f>>a[i];
for(i=1;i<n;i++)
{
for(j=i+1;j<=n;j++)
if(a[i]>a[j])
a[i]+=a[j],a[j]=a[i]-a[j],a[i]-=a[j];
g<<a[i]<<" ";
}g<<a[n];
return 0;
}