poj 2388 insert sorting
/** \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的更多相关文章
- POJ 2388 Who's in the Middle(水~奇数个数排序求中位数)
题目链接:http://poj.org/problem?id=2388 题目大意: 奇数个数排序求中位数 解题思路:看代码吧! AC Code: #include<stdio.h> #in ...
- POJ 2388(排序)
http://poj.org/problem?id=2388 题意:就N个数的中位数. 思路:用快排就行了.但我没用快排,我自己写了一个堆来做这个题.主要还是因为堆不怎么会,这个拿来练练手. #inc ...
- Poj/OpenJudge 1094 Sorting It All Out
1.链接地址: http://poj.org/problem?id=1094 http://bailian.openjudge.cn/practice/1094 2.题目: Sorting It Al ...
- [POJ 1007] DNA Sorting C++解题
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 77786 Accepted: 31201 ...
- poj 1007:DNA Sorting(水题,字符串逆序数排序)
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 80832 Accepted: 32533 Des ...
- poj 1007 DNA Sorting 解题报告
题目链接:http://poj.org/problem?id=1007 本题属于字符串排序问题.思路很简单,把每行的字符串和该行字符串统计出的字母逆序的总和看成一个结构体.最后把全部行按照这个总和从小 ...
- [POJ] #1007# DNA Sorting : 桶排序
一. 题目 DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 95052 Accepted: 382 ...
- poj 1007 DNA Sorting
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 95437 Accepted: 38399 Des ...
- POJ 2388&&2299
排序(水题)专题,毕竟如果只排序不进行任何操作都是极其简单的. 事实上,排序算法十分常用,在各类高级的算法中往往扮演着一个辅助的部分. 它看上去很普通,但实际的作用却很大.许多算法在失去排序后将会无法 ...
随机推荐
- bzoj 2045: 双亲数
2045: 双亲数 Description 小D是一名数学爱好者,他对数字的着迷到了疯狂的程度. 我们以d = gcd(a, b)表示a.b的最大公约数,小D执著的认为,这样亲密的关系足可以用双亲来描 ...
- 2017-2018-1 JAVA实验站 冲刺 day02
2017-2018-1 JAVA实验站 冲刺 day02 各个成员今日完成的任务 小组成员 今日工作 完成进度 张韵琪 写博客.进行工作总结 100% 齐力锋 找背景音乐.开始界面图片.按钮图片.按钮 ...
- 69.广搜练习: 最少转弯问题(TURN)
[问题描述] 给出一张地图,这张地图被分为n×m(n,m<=100)个方块,任何一个方块不是平地就是高山.平地可以通过,高山则不能.现在你处在地图的(x1,y1)这块平地,问:你至少需要拐几个弯 ...
- Codeforces Round #346 (Div. 2) E. New Reform dfs
E. New Reform 题目连接: http://www.codeforces.com/contest/659/problem/E Description Berland has n cities ...
- nodejs 导入导出模块module.exports向外暴露多个模块 require导入模块
.moudel.exports 导出模块 导出单个模块 // user.js moudel.exports = 函数名或者变量名: //app.js 导入 require('user.js') 当然. ...
- Inrush limiter also provides short-circuit protection
For containing large amounts of bulk capacitance, controlling inrush currents poses problems. The si ...
- The differentiation program with abstract data
#!r6rs ( import ( rnrs base ( 6 ) ) ( rnrs io simple ( 6 ) ) ) ( define ( deriv exp var ) ...
- DELPHI PROTOBUF免费的开源支持库fundamentals5
DELPHI PROTOBUF免费的开源支持库fundamentals5 1.源码URL: https://github.com/fundamentalslib/fundamentals5 2.编译P ...
- 页游安全攻与防,SWF加密和隐藏密匙
原文链接:http://netsecurity.51cto.com/art/201211/364775.htm 页游,最最核心的就是客户端(swf)与服务端的游戏通信了.游戏通信产生的封包,内容是否可 ...
- 第十五章 php时区报错 We selected the timezone 'UTC'
Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to ...