Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:sort

Posted by azma at 2009-03-16 16:35:17 on Problem 2388
In 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator