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

What's Wrong?

Posted by songuno1 at 2005-12-25 22:46:24 on Problem 2623
#include <stdio.h>
#include <algorithm>

using namespace std;

int N;
int D[250000];

int main (){
	int i;
	
	scanf ( "%d", &N );
	for (i=0; i<N; i++) scanf ( "%d", &D[i] );
	
	sort ( D, D+N );
	
	if (N%2) printf ( "%d", D[N/2] );
	else{
		if ((D[N/2]+D[N/2-1])%2==0) printf ( "%d", (D[N/2]+D[N/2-1])/2 );
		else printf ( "%.1lf", (double)(D[N/2]+D[N/2-1])/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