51Nod--1018排序
来源:互联网 发布:java中compareto的用法 编辑:程序博客网 时间:2024/06/09 01:10
1018 排序
基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题
收藏
关注
给出N个整数,对着N个整数进行排序
Input
第1行:整数的数量N(1 <= N <= 50000)第2 - N + 1行:待排序的整数(-10^9 <= A[i] <= 10^9)
Output
共n行,按照递增序输出排序好的数据。
Input示例
554321
Output示例
12345
源代码:
<span style="font-size:18px;">#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<stack>#include<queue>#include<vector>#include<deque>#include<map>#include<set>#include<algorithm>#include<string>#include<iomanip>#include<cstdlib>#include<cmath>#include<sstream>#include<ctime>using namespace std;int ans[50005];int cmp(const int &a,const int &b){ return a < b;}int main(){ int n; int i; scanf("%d",&n); for(i = 0; i < n; i++) scanf("%d",&ans[i]); //sort(ans,ans+n);//默认从小到大 sort(ans,ans+n,cmp); for(i = 0; i < n; i++) printf("%d\n",ans[i]);return 0;}</span>
0 0
- 51Nod--1018排序
- 51nod 1018 排序
- 51nod-【1018 排序】
- 【51Nod】1018 排序
- 51Nod 1018 排序
- 51Nod--1018 排序
- 51Nod-1018-排序
- 51nod 1018 排序
- 51NOD-1018 排序
- 51Nod-1018 排序【排序】
- 51Nod 1018 排序 STL
- 51Nod-1018-排序
- 51nod 1485字母排序
- 51Nod-1020-逆序排序
- 51Nod - 1097 思维 + 排序
- 51Nod-1485-字母排序
- 特殊的排序 51Nod
- 51Nod-1874-字符串排序
- HLG 2015 千万次的问
- mysql局域网连接设置——Windows
- 插入排序 二分查找插入排序
- 2.JavaWeb复习 之servlet和jsp之间传值问题
- mfc 选择文件并显示
- 51Nod--1018排序
- Android NestedScrolling机制完全解析 带你玩转嵌套滑动
- Android高手进阶教程(九)之----Android Handler的使用!!!
- 14 List,Set,Map的区别
- 数据结构实验之查找六:顺序查找
- SVM资料记录
- Android shape属性的全解
- virtual与abstract区别
- android各大手机系统打开权限管理页面