Who's in the Middle
2015-07-31 14:16
344 查看
题目链接:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1§ionid=3&problemid=21
方法:排序
思路:排序后选出中间值,简单题
难点:注意数组下标的对应关系
方法:排序
思路:排序后选出中间值,简单题
难点:注意数组下标的对应关系
#include<cstdio> #include<algorithm> using namespace std; int main() { int h[10000+10]; int n; while(~scanf("%d",&n)) { for(int i = 1; i <= n;i++) scanf("%d",&h[i]); sort(h+1,h+n+1); printf("%d\n",h[n/2+1]); } }
相关文章推荐
- php学习笔记_3_php语法需要注意的点及hereDoc和nowDoc
- Win10开始菜单如何改回Win7经典样式?
- 来自微软的一手内幕:Windows 10是怎么出炉的
- Chapter 15 Alternative Storage Engines 替代存储引擎
- phantomjs使用说明
- IOS数据库的一些了解操作
- Jquery(2.1) 对checkbox的操作(全选,反选,单个操作)
- hdu5335
- 简简单单的讲sort
- DLL and PLL for detail statement
- activity页面多次反复切换会变卡。
- linux识别ntfs文件系统
- 免费使用公共CDN静态库加速
- Android 基础控件汇总之AlertDialog
- 积木搭建解题报告
- Mac OS X 安装protobuf 2.6.1
- win7/8怎么屏蔽win10正式版的安装包提示?
- Hibernate-note03
- 4000 匹配算法·温故知新——「前言」
- PhantomJS:基于WebKit、开源的服务器端JavaScript API