当前位置:网站首页>ZZULIOJ 1116 Delete elements [delete]
ZZULIOJ 1116 Delete elements [delete]
2022-08-10 10:04:00 【An Ran_】
1116: delete element
Time limit: 1 Sec Memory limit: 128 MB
Submitted: 20393 Solved: 12008
[status] [discussion boarda>] [Submit] [Submit by:admin]Title description
Input an incrementally ordered integer array A with n elements, delete the element with subscript i to keep it in continuous order.Note that valid subscripts start at 0.The following two functions are defined to implement delete element operation and array output operation respectively.
void del(int a[], int n, int i); /*Delete the element with index i in the array a*/
void PrintArr(int a[], int n); /*OutputThe first n elements of array a */Enter
The input is divided into three lines, the first line is an integer n (n<10), the second line is n integers, and the third line is the subscript i of the element to be deleted, i>=0.
Output
Output the array elements after deleting the element with subscript i, and separate the data with spaces.
Sample input Copy
61 3 5 7 9 113Sample output Copy
1 3 5 9 11Tips
Please note that when the array has only one element and is deleted, the array is empty, and there should be no output at this time.A common mistake is to output the first element or a carriage return in this case.
#include void del(int a[], int n, int i);void PrintArr(int a[], int n);int main(){int n;int i,j;int a[20];scanf("%d",&n);for(i=0;i Key analysis of problem solving:
(1) Delete operation
Locate the position to be deleted and move forward in turn (for loop implementation)
Additional: Insert operation: locate the position to be inserted and move backward
边栏推荐
猜你喜欢

Matlab符号函数的生成及计算其函数值

Excel draws statistical graphs

"Microservice Architecture" Arrangement and Choreography - Different Models for Making Systems Work Together

绘制温度曲线图;QChart,

CatchAdmin实战教程(四)Table组件之自定义基础页面

91.(cesium之家)cesium火箭发射模拟

「数据架构」数据模型,数据字典,数据库模式 和ERD的比较

ESP8266 教程1 — ESP8266硬件平台介绍

Static关键字及应用,继承的概念

「敏捷建模」纪律:敏捷设计理念
随机推荐
数据中台解决方案及未来发展方向
VBA: Inputbox Function and Inputbox Method
Plot temperature curves; QChart,
「数据架构」数据模型,数据字典,数据库模式 和ERD的比较
web项目访问引用jar内部的静态资源
Relearn bubble sort
PostgreSQL 2022 发展现状:13 个非 psql 工具
「数据战略」结果驱动的企业数据策略:组织和治理
【Prometheus】Node Exporter常用查询PromQL 语句大总结
keepalived:常见问题
重学冒泡排序
【软考 系统架构设计师】案例分析⑥ Web应用系统架构设计
Development environment variable record under win
「业务架构」TOGAF建模:组织分解图(组织映射)
ES复杂操作搜索
交换 生成树 知识总结
C语言空白符、空格符 与转义字符题点总结
How to understand the difference between BIO, NIO, and AIO
GO文件相关操作使用
UE4 粒子特效基础学习 (01-将粒子效果挂载到角色身上)