| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:sortIn Reply To:Re:sort Posted by:azma at 2009-03-16 16:00:49 #include <stdio.h>
//#include <conio.h>
int min(int a[],int L,int r)
{
int m=a[L];
int i,index=L;
for (i=L+1;i<r;i++)
if ( m>a[i]){
m=a[i];
index=i;
}
return index ;
}
void ssort(int a[],int n){
int i,index;
for(i=0;i<n-1;i++)
{
index=min(a,i,n);
int temp=a[i];
a[i]=a[index];
a[index]=temp;
}
}
int main()
{
int n,i;
scanf ("%d",&n);
int a[100000];
for (i=0;i<n;i++)//;
scanf ("%d",&a[i]);
ssort(a,n);
printf("%d",a[n>>1]);
//getch();
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator