当前位置:网站首页>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];
}
边栏推荐
- Day05 table
- “疫”起坚守 保障数据中台服务“不打烊”
- AI 助力艺术设计抄袭检索新突破!刘芳教授团队论文被多媒体顶级会议ACM MM录用
- File contains vulnerability summary
- Leetcode 121 best time to buy and sell stock (simple)
- Ka! Why does the seat belt suddenly fail to pull? After reading these pictures, I can't stop wearing them
- 查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
- Pyinstaller packaging py script warning:lib not found and other related issues
- 技术实践|线上故障分析及解决方法(上)
- CesiumJS 2022^ 源码解读[8] - 资源封装与多线程
猜你喜欢
CesiumJS 2022^ 源码解读[8] - 资源封装与多线程
Openbionics exoskeleton project introduction | bciduino community finishing
MPLS③
Long article review: entropy, free energy, symmetry and dynamics in the brain
Solution to the problem that jsp language cannot be recognized in idea
I don't care about you. OKR or KPI, PPT is easy for you
Audio resource settings for U3D resource management
Use classname to modify style properties
MySQL introduction - functions (various function statistics, exercises, details, tables)
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
随机推荐
HackTheBox-baby breaking grad
MySQL uses the view to report an error, explain/show can not be issued; lacking privileges for underlying table
Oracle database knowledge points (I)
Special copy UML notes
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,
PMP 考试常见工具与技术点总结
使用dnSpy对无源码EXE或DLL进行反编译并且修改
mysql使用视图报错,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
LeetCode226. Flip binary tree
About uintptr_ T and IntPtr_ T type
Day05 table
Day05 表格
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
Msp32c3 board connection MSSQL method
Future source code view -juc series
Douban scoring applet Part-3
MySQL deadly serial question 2 -- are you familiar with MySQL index?
Openbionics robot project introduction | bciduino community finishing
Oracle database knowledge points that cannot be learned (II)
Idsia & supsi & usi | continuous control behavior learning and adaptive robot operation based on Reinforcement Learning