Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求助 我用nth_element() 为什么 不行 请帮忙 老Wa#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator