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

一直WA,求解惑

Posted by a2659633 at 2011-08-15 18:48:34 on Problem 2623
#include<stdio.h>
#include<stdlib.h>
int c(const void *a,const void *b)
{
	return *((int *)a)-*((int *)b);
}
double s[300000];
int main()
{
	int i,n;
	double m;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%lf",s+i);
	qsort(s,n,sizeof(double),c);
	if(n%2==1) printf("%.1lf\n",s[n/2]);
	else
	{
	m=s[n/2]/2.0+s[n/2-1]/2.0;
	printf("%.1lf\n",m);
	}
	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