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

。。。STL代码

Posted by TangMing at 2009-05-13 16:46:33 on Problem 2388 and last updated at 2009-05-13 16:48:16
#include<iostream>
#include<set>

using namespace std;

int main(int argc, char* argv[])
{   
	int n,nn,a,sum=0;
	multiset<int>ms;
	scanf("%d\n",&n);
	nn=n;
	while(n--)
	{scanf("%d",&a);
	 ms.insert(a);
	}
	multiset<int>::iterator it=ms.begin();
	for(int k=0;;it++)
	{
	if(k==nn/2)
	{ printf("%d\n",*it);break;}
	k++;
	}
	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