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

求助 我用nth_element() 为什么 不行 请帮忙 老Wa

Posted by goldenking at 2006-05-05 13:48:29 on Problem 2388
#include<iostream>
#include<fstream>
#include<algorithm>
#define MAXN 10000
using namespace std;
int main()
{
   
   long int milk[MAXN], N;
   long int result;
   int i;
   ifstream cin("d.in");
   while(cin>>N)
   {
	   for(i=0;i<N;i++)
		   cin>>milk[i];
	   result=N/2+1;
	   nth_element(milk, &result, milk+N);
	   cout<<milk[result-1]<<endl;
   }
   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