Uva 10107 - What is the Median?
来源:互联网 发布:京东域名多少钱买的 编辑:程序博客网 时间:2024/04/29 23:03
水题?
就是中位数
每次都sort都不会tle
其实可以用二分查找的
懒了=.=
1Y
#include<vector>#include<algorithm>#include<stdio.h>std::vector<int> q;int main(){q.clear();int x;while(scanf("%d",&x)!=EOF){q.push_back(x);sort(q.begin(),q.end());int len=q.size();if(len%2==1)printf("%d\n",q[len/2]);else printf("%d\n",(q[len/2]+q[len/2-1])/2); }return 0;}
- Uva 10107 - What is the Median?
- UVa 10107 What is the Median?
- UVa, 10107 What is the Median?
- UVa 10107 - What is the Median?
- uva 10107 What is the Median?
- UVa10107 What is the Median?
- UVA10107 What is the Median?
- uva 10056 - What is the Probability ?
- UVA - 10056 What is the Probability ?
- UVa:10056 What is the Probability ?
- UVa 10056 — What is the Probability?
- uva 10056 What is the Probability ?
- What is the Probability - UVa 10056 概率
- UVA - 10056 What is the Probability ?
- UVa 10646 - What is the Card?
- UVA 10056 What is the Probability ?
- UVA - 10056 What is the Probability ? 概率UVA - 10056 What is the Probability ?
- UVa 10056 What is the Probability ? (概率&有一个陷阱)
- tomcat自动加载问题
- 黑马程序员-IO练习2
- HDU 1885 Key Task(状态压缩+BFS)
- Linux设备驱动中的并发控制
- servlet客户端跳转+服务器端跳转
- Uva 10107 - What is the Median?
- 怎样处理怀孕期支气管哮喘?
- 对付妊娠期阴 道分泌物增加
- 怀孕中期怎样治宫颈糜烂?
- 妊娠期发烧时怎样选取药品
- 求各科成绩总分及均分
- 单链表排序
- servlet过滤器的链式处理
- 浅析C++临时对象的产生相关问题