当前位置:网站首页>ZZULIOJ: 1120: the most value to exchange
ZZULIOJ: 1120: the most value to exchange
2022-07-30 22:56:00 【catch up】
1120: max swap
Time limit: 1 Sec Memory limit: 128 MB
[Status] [Discussion Board] [Submit] [Submit by:admin]
Title description
There is a sequence of integers of length n.Write a program that swaps the minimum value with the first number in a sequence, and then swaps the maximum value with the last number.Output the converted sequence.Write two functions MinIndex() and MaxIndex() to calculate the minimum and maximum subscripts, respectively.
int MinIndex(int a[], int n); //The function returns the index of the smallest element in the array a
int MaxIndex(int a[], int n); //The function returns the index of the largest element in the array a
The output of the array elements calls the function PrintArr().
Enter
The input consists of two lines.
The first line is a positive integer n (1≤n≤10).
The second line is a sequence of n positive integers to ensure that there are no repeated elements.
Output
Output the converted sequence.Separate the data with spaces.
Sample input Copy
55 4 1 2 3
Sample output Copy
1 4 3 2 5
Reference Code
#include #include void PrintArr(int a[], int n);int MinIndex(int a[], int n);int MaxIndex(int a[], int n);int insert(int a[], int n, int num);int main(){int a[10], n, i, j, b;scanf("%d", &n);for(i=0;ic){c=a[i];m=i;}}return m;}void PrintArr(int a[], int n){int i;for(i=0;i 边栏推荐
- cnpm installation steps
- vulnhub靶机AI-Web-1.0渗透笔记
- Jetson AGX Orin 平台关于c240000 I2C总线和GMSL ses地址冲突问题
- cmd (command line) to operate or connect to the mysql database, and to create databases and tables
- Apache Doris系列之:深入认识实时分析型数据库Apache Doris
- Gxlcms audio novel system/novel listening system source code
- “蔚来杯“2022牛客暑期多校训练营4 N.Particle Arts 规律 方差
- [MySQL] DQL related operations
- StoneDB 为何敢称业界唯一开源的 MySQL 原生 HTAP 数据库?
- 【MySQL】MySQL中对数据库及表的相关操作
猜你喜欢
随机推荐
PhpMetrics usage
成功解决ModuleNotFoundError: No module named ‘Image‘
【2022-05-31】JS逆向之易企秀
MySQL连接时出现2003错误
Jetson AGX Orin 平台关于c240000 I2C总线和GMSL ses地址冲突问题
Installation and use of cnpm
【科研】文献下载神器方式汇总
vulnhub靶机AI-Web-1.0渗透笔记
d使用among的问题
WSL安装图形界面并通过xrdp/X-Launch访问
VS2017编译Tars测试工程
Debezium报错系列之二十:task failed to create new topic.Ensure that the task is authorized to create topics
Go1.18升级功能 - 泛型 从零开始Go语言
【Summary】机器人方法汇总
QT开发简介、命名规范、signal&slot信号槽
语言代码表
go版本升级
ThinkPHP高仿蓝奏云网盘系统源码/对接易支付系统程序
Excel基础学习笔记
Apache Doris series: detailed steps for installation and deployment

![[MySQL] Related operations on databases and tables in MySQL](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)






