POJ 2388 Who's in the Middle(水~奇数个数排序求中位数)
题目链接:http://poj.org/problem?id=2388
题目大意:
奇数个数排序求中位数
解题思路:看代码吧!
AC Code:
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int na[n+];
for(int i=; i<n; i++)
scanf("%d",&na[i]);
sort(na,na+n);
printf("%d\n",na[n/]);
}
return ;
}
POJ 2388 Who's in the Middle(水~奇数个数排序求中位数)的更多相关文章
- poj 2388 Who's in the Middle
点击打开链接 Who's in the Middle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 28324 Acce ...
- POJ 2388 Who's in the Middle (快速选择算法:O(N)求数列第K大)
[题意]求数列中间项. ---这里可以扩展到数列第K项. 第一次做的时候直接排序水过了= =--这一次回头来学O(N)的快速选择算法. 快速选择算法基于快速排序的过程,每个阶段我们选择一个数为基准,并 ...
- poj 2388 Who's in the Middle(快速排序求中位数)
一.Description FJ is surveying his herd to find the most average cow. He wants to know how much milk ...
- POJ 2388&&2299
排序(水题)专题,毕竟如果只排序不进行任何操作都是极其简单的. 事实上,排序算法十分常用,在各类高级的算法中往往扮演着一个辅助的部分. 它看上去很普通,但实际的作用却很大.许多算法在失去排序后将会无法 ...
- poj 2388 insert sorting
/** \brief poj 2388 insert sorting 2015 6 12 * * \param * \param * \return * */ #include <iostrea ...
- POJ.2739 Sum of Consecutive Prime Numbers(水)
POJ.2739 Sum of Consecutive Prime Numbers(水) 代码总览 #include <cstdio> #include <cstring> # ...
- 蓝桥杯 算法训练 Torry的困惑(基本型)(水题,筛法求素数)
算法训练 Torry的困惑(基本型) 时间限制:1.0s 内存限制:512.0MB 问题描述 Torry从小喜爱数学.一天,老师告诉他,像2.3.5.7……这样的数叫做质数.Torry突 ...
- POJ 3415 不小于k的公共子串的个数
Common Substrings Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 9248 Accepted: 3071 ...
- POJ 2388:Who's in the Middle
Who's in the Middle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 31015 Accepted: 1 ...
随机推荐
- ubuntu14.04 安装配置JDK1.7
1,下载jdk-7u45-linux-x64.tar.gz 网址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downlo ...
- [转]制作png格式透明图片的简易方法
原文地址:http://blog.csdn.net/zhouyingge1104/article/details/24460743 photoshp之类的专业软件太复杂,其实,制作透明图标有比较简易的 ...
- jQuery常用的元素查找方法总结
$("#myELement") 选择id值等于myElement的元素,id值不能重复在文档中只能有一个id值是myElement所以得到的是唯一的元素 $("di ...
- 表单提交中get和post方式的区别
表单提交中get和post方式的区别有5点 1.get是从服务器上获取数据,post是向服务器传送数据. 2.get是把参数数据队列加到提交表单的ACTION属性所指的URL中,值和表单内各个字段一一 ...
- list 集合
1.Model public class ROLE_FUNCTION { //角色集合 public List< ROLE> ROLES { get; set; } //角色权限集合 pu ...
- C# 通过后台获取浏览器域名
通过httpContext.获取当前地址当前主机域名 string url = HttpContext.Current.Request.Url.Host.ToString();
- phpwind9.0模板制作教程——制作论坛风格
由于论坛模板机制和门户等模板机制不同,所以今天我就先重点讲讲论坛模板制作的大概过程. 一.先来熟悉下phpwind9.0的论坛模板机制. 其实phpwind9.0的模板机制和discuzx2.5差不多 ...
- jQuery调用WebService实现增删改查的实现
第一篇博客,发下我自己写的jQuery调用WebService实现增删改查的实现. 1 <!DOCTYPE html> 2 3 <html xmlns="http://ww ...
- Hash_P1026毒药?解药?
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> ...
- BZOJ1070 [SCOI2007]修车
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...