HDU 1040 As Easy As A+B (排序。。。水题)
排序 HDU as Easy 水题
2023-09-11 14:17:19 时间
题意:给定n个数,让你从小到大排序。
析:不说什么了。
代码如下:
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const int maxn = 1000 + 5; int a[maxn]; int main(){ int T, n; cin >> T; while(T--){ scanf("%d", &n); for(int i = 0; i < n; ++i) scanf("%d", &a[i]); sort(a, a+n); printf("%d", a[0]); for(int i = 1; i < n; ++i) printf(" %d", a[i]); printf("\n"); } return 0; }
相关文章
- java运用Comparator为对象排序
- Java中的TreeSet集合会自动将元素升序排序
- Stooge排序与Bogo排序算法
- Java实现 LeetCode 324 摆动排序 II
- Java实现Labeling Balls(拓扑排序的应用)
- Java实现希尔排序
- 从零开始_学_数据结构(六)——排序(冒泡、插入、希尔、简单选择、归并、快速)
- 2364. 统计坏数对的数目-数学推导转化+快速排序-搜索相同元素集合题解
- C++有序vector之每插入一个元素后重新排序
- hdu 4911 Inversion(归并排序求逆序对数)2014多校训练第5场
- 力扣:排序问题
- 后缀子串排序
- 数据结构 bst二叉排序树 节点删除