当前位置:网站首页>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];
}边栏推荐
- Long article review: entropy, free energy, symmetry and dynamics in the brain
- 【.NET+MQTT】. Net6 environment to achieve mqtt communication, as well as bilateral message subscription and publishing code demonstration of server and client
- Technical practice online fault analysis and solutions (Part 1)
- Make drop-down menu
- be based on. NETCORE development blog project starblog - (14) realize theme switching function
- 机器学习基础:用 Lasso 做特征选择
- String hash, find the string hash value after deleting any character, double hash
- Characteristics of ginger
- Leetcode 121 best time to buy and sell stock (simple)
- All metal crowns - current market situation and future development trend
猜你喜欢

技術實踐|線上故障分析及解决方法(上)
![[common error] custom IP instantiation error](/img/de/d3f90cd224274d87fcf153bb9244d7.jpg)
[common error] custom IP instantiation error

A malware detection method for checking PLC system using satisfiability modulus theoretical model

Characteristics of ginger

TP5 automatic registration hook mechanism hook extension, with a complete case

CLP information - how does the digital transformation of credit business change from star to finger?

be based on. NETCORE development blog project starblog - (14) realize theme switching function

查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题

基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能

Luogu p1309 Swiss wheel
随机推荐
Future source code view -juc series
File contains vulnerability summary
Mobile phone battery - current market situation and future development trend
AI helps make new breakthroughs in art design plagiarism retrieval! Professor Liu Fang's team paper was employed by ACM mm, a multimedia top-level conference
CesiumJS 2022^ 源码解读[8] - 资源封装与多线程
ThinkPHP uses redis to update database tables
Three layer switching ②
TP5 automatic registration hook mechanism hook extension, with a complete case
[common error] custom IP instantiation error
Idsia & supsi & usi | continuous control behavior learning and adaptive robot operation based on Reinforcement Learning
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
How can enterprises optimize the best cost of cloud computing?
Force buckle day32
Pesticide synergist - current market situation and future development trend
Future源码一观-JUC系列
QML add gradient animation during state transition
Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL
Future source code view -juc series
Oracle database knowledge points that cannot be learned (II)
Trading software programming