BZOJ1753: [Usaco2005 qua]Who's in the Middle
2017-07-21 14:14
471 查看
问n<=10000个点的中位数。
水题必有玄机!(然后浪费了半天在怎么O(n)求中位数并且最后放弃了)
1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<cstdlib> 5 //#include<iostream> 6 using namespace std; 7 8 int n; 9 #define maxn 10011 10 int a[maxn]; 11 int main() 12 { 13 scanf("%d",&n); 14 for (int i=1;i<=n;i++) scanf("%d",&a[i]); 15 sort(a+1,a+1+n); 16 printf("%d\n",a[(n+1)/2]); 17 return 0; 18 }View Code
相关文章推荐
- BZOJ1753 [Usaco2005 qua]Who's in the Middle
- bzoj1753 [Usaco2005 qua]Who's in the Middle
- bzoj 1753: [Usaco2005 qua]Who's in the Middle【排序】
- 1753: [Usaco2005 qua]Who's in the Middle
- bzoj1753 [Usaco2005 qua]Who's in the Middle
- bzoj1753 [Usaco2005 qua]Who's in the Middle
- 1753: [Usaco2005 qua]Who's in the Middle (快速排序)
- BZOJ 1753 Who's in the Middle
- bzoj1752 [Usaco2005 qua]Til the Cows Come Home
- bzoj1752 [Usaco2005 qua]Til the Cows Come Home
- bzoj1687: [Usaco2005 Open]Navigating the City 城市交通
- bzoj1754 [Usaco2005 qua]Bull Math
- bzoj1751 [Usaco2005 qua]Lake Counting
- 【bzoj1742】[Usaco2005 nov]Grazing on the Run 边跑边吃草 区间dp
- 2388 -- Who's in the Middle(解题报告)
- 【BZOJ4101】[Usaco2015 Open]Trapped in the Haybales Silver 二分
- bzoj1748 [Usaco2005 open]Around the world 环球飞行
- bzoj1675 [Usaco2005 Feb]Rigging the Bovine Election 竞选划区
- poj 2388 Who's in the Middle(快速排序求中位数)
- bzoj1751 [Usaco2005 qua]Lake Counting