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

为什么会错呢?

Posted by hubo430 at 2005-12-03 12:04:29 on Problem 2388
#include<stdio.h>
#include<iostream.h>
#include<stdlib.h>
int main()
{
	int n,i,*p;
	int com(const void*,const void *);
	scanf("%d",&n);
	p=new int[n];
	for(i=0;i<n;i++) scanf("%d",&p[i]);
	qsort((void*)p,n,sizeof(p[0]),com);
	printf("%d\n",p[n/2]);
	delete []p;
	return 0;
}
int com( const void*a,const void *b)
{
	return *(int*)a>=*(int*)b;
}


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