| ||||||||||
| 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:19:13 #include<stdio.h>
void Isort(int num[],int size)
{
int i;
int j;
for(i=1;i<size;i++){
j=i-1;
int temp=num [i];
while(j>=0&&temp<num[j])
{
num[j+1] = num[j];
j--;
}
num [j+1] = temp;
}
}
int main()
{
int num[10000];
int size;
int i,j;
scanf("%d",&size);
for(i=0;i<size;i++)
scanf("%d",&num[i]);
Isort(num,size);
printf("%d",num[size/2]);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator