美团8.13笔试

只看到两道题

外卖
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int count =1;
        for (int i = 0; i < n; i++) {
            int temp = sc.nextInt();
            if (temp >= m * count) {
                count++;
            }
        }
        System.out.println(n-count+1);
    }
}

扑克
public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        for (int i = n-1; i >=0; i--) {
            list.add(nums[i]);
            Integer integer = list.get(0);
            list.remove(integer);
            list.add(integer);
            integer = list.get(0);
            list.remove(integer);
            list.add(integer);
        }
        for (int i = n-1; i >=0 ; i--) {
            System.out.print(list.get(i)+" ");
        }
    }
}



#美团笔试java#
全部评论
第一题啥意思 我咋半天没看懂啊
点赞 回复 分享
发布于 2022-08-13 19:00
都过了100%吗
点赞 回复 分享
发布于 2022-08-13 19:55

相关推荐

牛客246576843号:建议简历对点优化,想做HR专门列出HR实习,想做运营专门列出运营实习,并且对点写出项目经历以及数据,同时在个人总结上可以多凸出和岗位的匹配度
点赞 评论 收藏
分享
被加薪的哈里很优秀:应该继续招人,不会给你留岗位的
点赞 评论 收藏
分享
评论
3
4
分享

创作者周榜

更多
牛客网
牛客企业服务