swust oj 1014
交换排序算法的设计与实现——冒泡排序
输入
第一行是待排序数据元素的个数;
第二行是待排序的数据元素。
输出
第一行输出第一趟冒泡排序的结果。
样例输入
10
50 36 41 19 23 4 20 18 12 22
样例输出
36 41 19 23 4 20 18 12 22 50
#include<iostream>
using namespace std;
int main()
{
int n,a[];
cin>>n;
for(int i=;i<n;i++)
{
cin>>a[i];
}
for(int i=;i<n;i++)
{
if(a[i]<a[i-])
{
a[i]=a[i]^a[i-];
a[i-]=a[i]^a[i-];
a[i]=a[i]^a[i-];
}
}
for(int i=;i<n;i++)
cout<<a[i]<<" ";
return ;
}
swust oj 1014的更多相关文章
- [Swust OJ 404]--最小代价树(动态规划)
题目链接:http://acm.swust.edu.cn/problem/code/745255/ Time limit(ms): 1000 Memory limit(kb): 65535 Des ...
- [Swust OJ 649]--NBA Finals(dp,后台略(hen)坑)
题目链接:http://acm.swust.edu.cn/problem/649/ Time limit(ms): 1000 Memory limit(kb): 65535 Consider two ...
- SWUST OJ NBA Finals(0649)
NBA Finals(0649) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 404 Accepted: 128 Descri ...
- [Swust OJ 1023]--Escape(带点其他状态的BFS)
解题思路:http://acm.swust.edu.cn/problem/1023/ Time limit(ms): 5000 Memory limit(kb): 65535 Descript ...
- [Swust OJ 1125]--又见GCD(数论,素数表存贮因子)
题目链接:http://acm.swust.edu.cn/problem/1125/ Time limit(ms): 1000 Memory limit(kb): 65535 Descriptio ...
- [Swust OJ 1126]--神奇的矩阵(BFS,预处理,打表)
题目链接:http://acm.swust.edu.cn/problem/1126/ Time limit(ms): 1000 Memory limit(kb): 65535 上一周里,患有XX症的哈 ...
- [Swust OJ 1026]--Egg pain's hzf
题目链接:http://acm.swust.edu.cn/problem/1026/ Time limit(ms): 3000 Memory limit(kb): 65535 hzf ...
- [Swust OJ 1139]--Coin-row problem
题目链接: http://acm.swust.edu.cn/contest/0226/problem/1139/ There is a row of n coins whose values are ...
- [Swust OJ 385]--自动写诗
题目链接:http://acm.swust.edu.cn/problem/0385/ Time limit(ms): 5000 Memory limit(kb): 65535 Descripti ...
随机推荐
- python中的operator.itemgetter函数
operator.itemgetter函数operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号.看下面的例子 a = [,,] >>> b=) ...
- QT学习之如何在QToolBar中添加带图标的QToolButton并设置图标大小
在网上查到了三种方法,找到一种比较好理解的. 使用QIcon类: QToolButton *toolBtn1 = new QToolButton(this); //创建QToolButton tool ...
- debug 2
Red Hat Developer Toolsetdelivers the latest stable versions of essential GCC C, C++, Fortran, and s ...
- [转]GO err is shadowed during return
1 前言 有时候编译Go项目会出现GO err is shadowed during return的问题,是因为作用域导致变量重名,return时不是你预期的变量导致的. 2 样例 这里先复现问题,然 ...
- mathJax基础语法-0基础开始,(这是网上抄来的如果有权限和版权问题联系本人处理,仅供学术参考)
- mysql 利用druid 为访问密码加密
在原来数据库配置文件jdbc.properties 文件中增加几行加密文件 jdbc.username=rootjdbc.password=KqYkfcQkQOdOpCnaokLfb9Kbzdf+NG ...
- Font Awesome,一套绝佳的图标字体库和CSS框架
http://fontawesome.dashgame.com/ http://www.runoob.com/font-awesome/fontawesome-tutorial.html Font A ...
- ***OneinStack交互安装FAQ和管理服务常用命令
转自: https://oneinstack.com/install/ 自动生成oneinstack安装连接: https://oneinstack.com/auto/ (进入linux系统后复杂上 ...
- [原创]基于Zybo SDIO WiFi模块调试
采用的是RTL8189 SDIO 模块,介绍如下 The Realtek RTL8189ES-VB-CG is a highly integrated single-chip 802.11n Wire ...
- Liunx系统下的进程与线程
1. 进程.线程的概念 a. 进程是操作系统进行资源分配的单位. b. 线程(Thread)是程序中独立的指令流,是CPU调度和分派的基本单位. c. 多进程是指同时运行多种 ...