当前位置:网站首页>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];
}
边栏推荐
- Leetcode 121 best time to buy and sell stock (simple)
- Mongodb learning notes: command line tools
- Experimental animal models - current market situation and future development trend
- Openbionics robot project introduction | bciduino community finishing
- Hash table, string hash (special KMP)
- MySQL statement learning record
- Gee: create a new feature and set corresponding attributes
- C import Xls data method summary IV (upload file de duplication and database data De duplication)
- Special copy UML notes
- All in one 1412: binary classification
猜你喜欢
长文综述:大脑中的熵、自由能、对称性和动力学
Mobile asynchronous sending SMS verification code solution -efficiency+redis
Gee: create a new feature and set corresponding attributes
Since the "epidemic", we have adhered to the "no closing" of data middle office services
Three layer switching ②
GUI 应用:socket 网络聊天室
1-redis architecture design to use scenarios - four deployment and operation modes (Part 1)
Technical practice online fault analysis and solutions (Part 1)
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
Thinkphp6 integrated JWT method and detailed explanation of generation, removal and destruction
随机推荐
Future source code view -juc series
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
Special copy UML notes
Huawei BFD and NQA
Mobile asynchronous sending SMS verification code solution -efficiency+redis
All in one 1412: binary classification
How to use AHAS to ensure the stability of Web services?
What are the advantages and disadvantages of data center agents?
Typescript basic knowledge sorting
TP5 automatic registration hook mechanism hook extension, with a complete case
Oracle database knowledge points (I)
查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
Huawei rip and BFD linkage
How programmers find girlfriends through blind dates
2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)
Force buckle day32
Install the pit that the electron has stepped on
MPLS experiment
C import Xls data method summary III (processing data in datatable)
【.NET+MQTT】.NET6 环境下实现MQTT通信,以及服务端、客户端的双边消息订阅与发布的代码演示