hdoj1157
来源:互联网 发布:java冒泡排序 编辑:程序博客网 时间:2024/05/16 06:18
题目大意:
和poj2388同一道题。跟奇数个数字,输出中间值
解题思路:
无
代码如下:
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<math.h>int main(){ int n, i, x, j; int a[10005]; while(scanf("%d",&n)!=EOF) { for(i=0; i<n; i++) { scanf("%d",&a[i]); } for(i=0; i<n-1; i++) { for(j=i+1; j<n; j++) { if(a[i]>a[j]) { x=a[i]; a[i]=a[j]; a[j]=x; } } } printf("%d\n",a[n/2]); } return 0; }
0 0
- hdoj1157
- HDOJ1157水题算中值
- hdoj1157简单题、排序
- HDOJ1157 Who's in the Middle(排序)
- 双系统 ubuntu 和win7 修改开机启动项
- 浅谈Android之Binder原理介绍(一)
- ThinkBox仿thinkphp头像名片
- Vue1.0版本——TodoList
- stm32
- hdoj1157
- Git 常用命令
- 关于tomcat的设置
- ue4-Multiplayer Lobby Blueprint教程
- hibernateUtil中hibernate3和hibernate4的区别
- H3C UIS R390X G2服务器 官方资料下载
- 博弈总结
- hdoj1202
- window.location各属性含义