题解 | #序列中删除指定数字#

序列中删除指定数字

http://www.nowcoder.com/practice/7bbcdd2177a445a9b66da79512b32dd7

#include <stdio.h>
int main(){
    int n,a[50],temp,num=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    scanf("%d",&temp);
    for(int i=0;i<n-num;i++){
        if(a[i]==temp) {
            num++;
            for(i;i<n-1;i++){
                a[i]=a[i+1];
            }
            i=-1;
        }
    }
    for(int i=0;i<n-num;i++){
        printf("%d ",a[i]);
    }
    return 0;
}
全部评论

相关推荐

牛客98820962...:个人意见,我觉得实习和项目经历要一致,达美乐感觉没必要写
点赞 评论 收藏
分享
2025-12-17 11:44
吉首大学 平台产品
黑着眼圈看手机:pdd秋招笔试挂了,春招还行吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务