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

序列中删除指定数字

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

import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] array=new int[n];
        for(int i=0;i<n;i++)
        {
            array[i]=sc.nextInt();
        }
        int shan=sc.nextInt();
        for(int i=0;i<n;i++)//要删就不输出😆         {
            if(array[i]==shan)
            {
                continue;
            }
            System.out.print(array[i]+" ");
        }
    }
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-09 12:10
直接上图
牛客13578115...:改得一般,不值80
点赞 评论 收藏
分享
陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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