当前位置:网站首页>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];
}边栏推荐
- ES6 deletes an attribute in all array objects through map, deconstruction and extension operators
- 查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
- [common error] custom IP instantiation error
- MPLS③
- Gee: create a new feature and set corresponding attributes
- Audio resource settings for U3D resource management
- 求esp32C3板子连接mssql方法
- 关于 uintptr_t和intptr_t 类型
- 1-redis architecture design to use scenarios - four deployment and operation modes (Part 1)
- Fundamentals of machine learning: feature selection with lasso
猜你喜欢

Thinkphp6 integrated JWT method and detailed explanation of generation, removal and destruction

GUI application: socket network chat room

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

Make drop-down menu

2020-12-02 SSM advanced integration Shang Silicon Valley

Do you know the eight signs of a team becoming agile?

Hash table, string hash (special KMP)

Fundamentals of machine learning: feature selection with lasso

Introduction to Tianchi news recommendation: 4 Characteristic Engineering

Mobile asynchronous sending SMS verification code solution -efficiency+redis
随机推荐
What are the advantages and disadvantages of data center agents?
Force buckle day32
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
String hash, find the string hash value after deleting any character, double hash
All in one 1412: binary classification
Introduction to superresolution
Maximum likelihood method, likelihood function and log likelihood function
Oracle database knowledge points (I)
LeetCode226. Flip binary tree
查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
Is Shengang securities company as safe as other securities companies
ThinkPHP uses redis to update database tables
A malware detection method for checking PLC system using satisfiability modulus theoretical model
How to set the response description information when the response parameter in swagger is Boolean or integer
Leetcode 121 best time to buy and sell stock (simple)
Functions and arrays of shell scripts
Lightweight Pyramid Networks for Image Deraining
C import Xls data method summary IV (upload file de duplication and database data De duplication)
Pesticide synergist - current market situation and future development trend
Gnupg website