美团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

相关推荐

码农索隆:有点耳熟,你们是我教过最差的一届
点赞 评论 收藏
分享
frutiger:逆天,我家就安阳的,这hr咋能说3k的,你送外卖不比这工资高得多?还说大厂来的6k,打发叫花子的呢?这hr是怎么做到说昧良心的话的
找工作时遇到的神仙HR
点赞 评论 收藏
分享
仁者伍敌:牛子这些人还会点一个自动回复,boss都不带回复的
点赞 评论 收藏
分享
评论
3
4
分享

创作者周榜

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