排序
来源:互联网 发布:淘宝客鹊桥活动玩法 编辑:程序博客网 时间:2024/06/08 20:06
Problem Description
给你N(N<=100)个数,请你按照从小到大的顺序输出。
Input
输入数据第一行是一个正整数N,第二行有N个整数。
Output
输出一行,从小到大输出这N个数,中间用空格隔开。
Example Input
5
1 4 3 2 5
Example Output
1 2 3 4 5
#include <iostream>#include <math.h>#include <cstdio>#include <cstring>#include <algorithm>//sort函数在这里面using namespace std;int a[10010];int b[10010];int main(){ int n; cin>>n; for(int i = 0; i < n; i++) { cin>>a[i]; } sort(a, a+n); for(int i = 0; i < n; i++) { if(i == 0) cout<<a[0]; else cout<<" "<<a[i]; } cout<<endl; return 0;}
阅读全文
0 0
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 排序
- 第一次打开这个博客仿佛进入一个神奇的地方
- python中标准的六个数据类型详解
- AVL树
- 使用maven构建web项目
- EOJ Monthly 2017.12 (暨 ECNU 12 月内部选拔) 题解
- 排序
- C语言实验——分割整数
- 简书个人中心,增加下拉刷新和放大头部视图
- 大数据梯度下降(斯坦福machine learning week 10)
- wpa_cli常用操作
- 在Linux环境下快速搭建一个javaweb项目网站(阿里云ubuntu)
- 一种不用额外空间反转整数的方法
- 42. Trapping Rain Water(H)
- Java万能接收页面数据,并自动匹配封装为map对象