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 scut_lf at 2010-12-02 00:55:28 on Problem 2623
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	float result;
	int n, i;
	cin >> n;
	vector<__int64> a(n);

	for ( i = 0; i < n; ++i )
	{
		scanf("%I64d",&a[i]);
	}

	stable_sort( a.begin (), a.end () );

	if ( n % 2 )
		result = a[(n - 1) / 2];
	else 
		result = (a[(n / 2) - 1] + a[n / 2]) / 2.0;

	printf("%.1f\n", result);

	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