题目链接: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(水~奇数个数排序求中位数)的更多相关文章

  1. poj 2388 Who's in the Middle

    点击打开链接 Who's in the Middle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 28324   Acce ...

  2. POJ 2388 Who's in the Middle (快速选择算法:O(N)求数列第K大)

    [题意]求数列中间项. ---这里可以扩展到数列第K项. 第一次做的时候直接排序水过了= =--这一次回头来学O(N)的快速选择算法. 快速选择算法基于快速排序的过程,每个阶段我们选择一个数为基准,并 ...

  3. 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 ...

  4. POJ 2388&&2299

    排序(水题)专题,毕竟如果只排序不进行任何操作都是极其简单的. 事实上,排序算法十分常用,在各类高级的算法中往往扮演着一个辅助的部分. 它看上去很普通,但实际的作用却很大.许多算法在失去排序后将会无法 ...

  5. poj 2388 insert sorting

    /** \brief poj 2388 insert sorting 2015 6 12 * * \param * \param * \return * */ #include <iostrea ...

  6. POJ.2739 Sum of Consecutive Prime Numbers(水)

    POJ.2739 Sum of Consecutive Prime Numbers(水) 代码总览 #include <cstdio> #include <cstring> # ...

  7. 蓝桥杯 算法训练 Torry的困惑(基本型)(水题,筛法求素数)

    算法训练 Torry的困惑(基本型) 时间限制:1.0s   内存限制:512.0MB      问题描述 Torry从小喜爱数学.一天,老师告诉他,像2.3.5.7……这样的数叫做质数.Torry突 ...

  8. POJ 3415 不小于k的公共子串的个数

    Common Substrings Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 9248   Accepted: 3071 ...

  9. POJ 2388:Who&#39;s in the Middle

    Who's in the Middle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 31015   Accepted: 1 ...

随机推荐

  1. 获取客户端ip地址

    新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js 新浪多地域测试方法:http://int.dpool. ...

  2. 用ElasticSearch和Protovis实现数据可视化

    搜索引擎最重要的目的,嗯,不出意料就是搜索.你传给它一个请求,然后它依照相关性返回你一串匹配的结果.我们可以根据自己的内容创造各种请求结构,试验各种不同的分析器,搜索引擎都会努力尝试提供最好的结果. ...

  3. python中的二维数组和lamda

    python列表推导式 list=[[0 for i in xrange(3)] for j in xrange(4)] 二维数组 g=lambda x,y:x*y; print g(2,9);

  4. js call与apply方法

    js中所有函数都默认定义了Call()与apply()两个方法,call与apply的第一个参数都是需要调用的函数对象,在函数体内这个参数就是this的值,剩余的参数是需要传递给函数的值,call与a ...

  5. Activiti 学习笔记记录

    官方在线用户手册(英文版):http://activiti.org/userguide/index.html 中文用户手册:http://www.mossle.com/docs/activiti/in ...

  6. 【USACO 1.2】Name That Number

    给你一串数字(≤12个),每个数字可以对应3个字母,求生成的所有字符串里,在字典内的有哪些. 我做的时候想的是字典树(Trie 树),模拟数串生成的所有字符串,然后在字典树里查找一下. /* TASK ...

  7. GCD详解

    什么是GCD? Grand Central Dispatch或者GCD,是一套低层API,提供了一种新的方法来进行并发程序编写.从基本功能上讲,GCD有点像 NSOperationQueue,他们都允 ...

  8. Java基础-关于session的详细解释

    转自:http://hi.baidu.com/zbzbzb/item/65d73d2a4d07cfd40f37f900 一.术语session 在我的经验里,session这个词被滥用的程度大概仅次于 ...

  9. 【poj1984】 Navigation Nightmare

    http://poj.org/problem?id=1984 (题目链接) 题意 给出一棵树,这棵树是以平面直角坐标系为基准建立的,也就是每个节点最多只有上下左右4条边.现在动态建树,同时询问两点间的 ...

  10. bzoj3295: [Cqoi2011]动态逆序对(cdq分治)

    #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...