当前位置:网站首页>Sequence sorting of basic exercises of test questions
Sequence sorting of basic exercises of test questions
2022-07-04 01:36:00 【White phoenix leans on the sword and returns】
Resource constraints
The time limit :1.0s Memory limit :512.0MB
Problem description
Given a length of n Sequence of numbers , Arrange the sequence in descending order .1<=n<=200
Input format
The first line is an integer n.
The second line contains n It's an integer , Is the number to be sorted , The absolute value of each integer is less than 10000.
Output format
Output one line , Output the sorted sequence in descending order .
The sample input
5
8 3 6 4 9
Sample output
3 4 6 8 9
The code is as follows :
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, i, a[201];
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
cout << a[0];
for (i = 1; i < n; i++)
cout << " " << a[i];
}边栏推荐
- [common error] UART cannot receive data error
- 机器学习基础:用 Lasso 做特征选择
- In the process of seeking human intelligent AI, meta bet on self supervised learning
- 长文综述:大脑中的熵、自由能、对称性和动力学
- 基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
- LeetCode 168. Detailed explanation of Excel list name
- Force buckle day32
- Oracle database knowledge points that cannot be learned (III)
- How programmers find girlfriends through blind dates
- Introduction to superresolution
猜你喜欢

LeetCode226. Flip binary tree

Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
![[common error] custom IP instantiation error](/img/de/d3f90cd224274d87fcf153bb9244d7.jpg)
[common error] custom IP instantiation error

Remember a lazy query error

MPLS experiment

Who moved my code!

Hash table, string hash (special KMP)

MySQL - use of aggregate functions and group by groups

HackTheBox-baby breaking grad

“疫”起坚守 保障数据中台服务“不打烊”
随机推荐
在寻求人类智能AI的过程中,Meta将赌注押向了自监督学习
Mongodb learning notes: command line tools
Fundamentals of machine learning: feature selection with lasso
C import Xls data method summary I (upload files and create Workbooks)
Function: store the strings entered in the main function in reverse order. For example, if you input the string "ABCDEFG", you should output "gfedcba".
All ceramic crowns - current market situation and future development trend
Solution of cursor thickening
In the process of seeking human intelligent AI, meta bet on self supervised learning
Solution to the problem that jsp language cannot be recognized in idea
Introduction to superresolution
All in one 1412: binary classification
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
51 MCU external interrupt
mysql使用视图报错,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
Function: find the sum of the elements on the main and sub diagonal of the matrix with 5 rows and 5 columns. Note that the elements where the two diagonals intersect are added only once. For example,
Introduction to Tianchi news recommendation: 4 Characteristic Engineering
Gee: create a new feature and set corresponding attributes
求esp32C3板子连接mssql方法
PMP 考试常见工具与技术点总结
Fundamentals of machine learning: feature selection with lasso