当前位置:网站首页>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
边栏推荐
猜你喜欢

SQL中的字符串截取函数

【数据架构】概念数据模型和逻辑数据模型有什么区别

win下的开发环境变量记录

Swin Transformer作者曹越加入智源,开展视觉基础模型研究

Which is the strongest workflow engine for "Technology Selection"?Chief Architecture Helps You Pick

Development environment variable record under win

「应用架构」TOGAF建模:企业可管理性图

Flutter实战-请求封装(五)之Isolate线程改造

「业务架构」TOGAF建模:组织分解图(组织映射)

哈希表,哈希桶的实现
随机推荐
mysql千万级别数据库优化
Oracle rac所在的网络要割接,停掉其中一个rac节点,这种方案可行吗?
用高质量图像标注数据加速AI商业化落地
"Guangzhou highway engineering measures for the supervision and administration of production safety, and revised from six aspects
《广州市公路工程安全生产监督管理办法》印发,从六大方面进行修订
细说Redis监控和告警
【物联网架构】什么是物联网平台?
「数据架构」:主数据管理(MDM)对我的行业有什么帮助?
GO文件相关操作使用
LeetCode Algorithm 914. 卡牌分组
【C语言】头文件#include <conio.h>,conio是Console Input/Output(控制台输入输出)
LiveNVR操作日志页面快速筛选上级国标平台的调用记录直播观看录像回看等操作
【STL】位图的介绍使用以及代码的模拟实现
Relearn bubble sort
关于编程本质那些事
ZZULIOJ 1124: 两个有序数组合并
单例模式基类
【微服务架构】微服务与SOA架构(2)
【数据仓库】什么是 Azure Synapse,它与 Azure Data Bricks 有何不同?
VBA: 采用Combox控件实现二级下拉菜单功能