/** \brief poj 2388 insert sorting 2015 6 12
*
* \param
* \param
* \return
*
*/ #include <iostream>
#include <cstdio>
#include <cstring> using namespace std; const int N=10000;
int Arr[N]; void insertSort(int len)
{
for(int j=1;j<len;j++)
{
int key=Arr[j];
int i=j-1;
while(i>=0 && Arr[i]>key)
{
Arr[i+1]=Arr[i];
i=i-1;
}
Arr[i+1]=key;
}
} int main()
{
//cout << "Hello world!" << endl;
int n;
scanf("%d",&n);
//while(scanf("%d",&n))
//{
memset(Arr,0,sizeof(Arr));
for(int i=0;i<n;i++)
//scanf("%d",Arr[i]);
cin>>Arr[i];
insertSort(n);
cout<<Arr[n/2]<<endl;
//}
return 0;
}

poj 2388 insert sorting的更多相关文章

  1. POJ 2388 Who's in the Middle(水~奇数个数排序求中位数)

    题目链接:http://poj.org/problem?id=2388 题目大意: 奇数个数排序求中位数 解题思路:看代码吧! AC Code: #include<stdio.h> #in ...

  2. POJ 2388(排序)

    http://poj.org/problem?id=2388 题意:就N个数的中位数. 思路:用快排就行了.但我没用快排,我自己写了一个堆来做这个题.主要还是因为堆不怎么会,这个拿来练练手. #inc ...

  3. Poj/OpenJudge 1094 Sorting It All Out

    1.链接地址: http://poj.org/problem?id=1094 http://bailian.openjudge.cn/practice/1094 2.题目: Sorting It Al ...

  4. [POJ 1007] DNA Sorting C++解题

        DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 77786   Accepted: 31201 ...

  5. poj 1007:DNA Sorting(水题,字符串逆序数排序)

    DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 80832   Accepted: 32533 Des ...

  6. poj 1007 DNA Sorting 解题报告

    题目链接:http://poj.org/problem?id=1007 本题属于字符串排序问题.思路很简单,把每行的字符串和该行字符串统计出的字母逆序的总和看成一个结构体.最后把全部行按照这个总和从小 ...

  7. [POJ] #1007# DNA Sorting : 桶排序

    一. 题目 DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95052   Accepted: 382 ...

  8. poj 1007 DNA Sorting

    DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95437   Accepted: 38399 Des ...

  9. POJ 2388&&2299

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

随机推荐

  1. [转]php-fpm - 启动参数及重要配置详解

    约定几个目录/usr/local/php/sbin/php-fpm/usr/local/php/etc/php-fpm.conf/usr/local/php/etc/php.ini 一,php-fpm ...

  2. hdu 3507 斜率优化

    我的第一道斜率优化. 就这道题而言,写出原始的方程: dp[i] = min{ dp[j] + (sum[i]-sum[j])2  + M | j in [0,i) } O(n^2)的复杂度肯定超时, ...

  3. Linux6.9用RPM方式安装MySQL5.7.21

    1.下载安装包 wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar ...

  4. YII 关联查询

    通过外键自己关联自己

  5. What is the Linux High Availabi

    What is the Linux High Availabi    简介:     高可用性群集的出现是为了使群集的整体服务尽可能可用,以便考虑计算硬件和软件的易错性.如果高可用性群集中的主节点发生 ...

  6. CentOS 6.9/7通过yum安装指定版本的Redis

    一.安装 // 安装依赖 # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && ...

  7. ADS-B显示终端6.0

    改动日志 1  更新背景地图. 增加了全国范围内的飞行限制区.飞行危急区.限制区採用黄色区域表示.危急区採用红色区域表示.全部原始资料均来自民航局发布的航行情报资料汇编. 2为解决显示元素过多,屏幕显 ...

  8. JVM:如何分析线程堆栈

    英文原文:JVM: How to analyze Thread Dump 在这篇文章里我将教会你如何分析JVM的线程堆栈以及如何从堆栈信息中找出问题的根因.在我看来线程堆栈分析技术是Java EE产品 ...

  9. Spring MVC一事务控制问题

    在近期一个项目中用了Spring MVC作为控制层框架,但却出现了一个让人非常费解的问题:事务控制. Spring MVC的配置文件名称为:springMVC-servlet.xml,内容例如以下: ...

  10. java通过jacob来读取word转换为htm格式

    转自:http://blog.csdn.net/chinapi_hzh/article/details/5798689 因为微软没有公开word源代码,所以直接用java流来读取word的后果是读出来 ...