[POJ 2388]Who's in the Middle

danihao123 posted @ 2016年8月17日 14:31 in 题解 with tags POJ 排序 , 838 阅读
转载请注明出处:http://danihao123.is-programmer.com/

这题题面长得挺吓人的(英文……),不过就是让你求中位数……

我怀疑会有卡快排的数据,不过我用的是STL的sort(sort好像用的不是普通的快排)

代码:

#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=10000;
int A[maxn];
int main(){
	register int i;
	int n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&A[i]);
	sort(A,A+n);
	printf("%d\n",A[n>>1]);
	return 0;
}
boardpaper.in 说:
Jul 04, 2023 11:34:37 AM

Students can obtain the 8th Model Question Paper West Bengal Board by using the information provided at a. If you boardpaper.in have any further queries, please leave them in the comments section.The crew is ready to help in any way they can.is a group of skilled journalists who have come together to provide specialised news coverage of recent events in India.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter