题解 | #小乐乐查找数字#

小乐乐查找数字

https://www.nowcoder.com/practice/4c49a3a1559141f7a080a48c98cca4cb

import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for(int i = 0;i < n;i++){
            list.add(in.nextInt());
        }
        int x = in.nextInt();
        System.out.println(Collections.frequency(list,x));
    }
    
}

全部评论

相关推荐

零OFFER战士:另一个版本查看图片
点赞 评论 收藏
分享
05-20 21:57
已编辑
门头沟学院 Java
喜欢吃卤蛋的悲伤蛙在...:建信融通没消息吧,我2说有实习挂简历不理了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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