PASS


用学校 z/k的人看成绩 看那些在50%内

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
        int x = sc.nextInt();
        while (x-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int k = sc.nextInt();
            int arr[] = new int[n];
            int sum[] = new int[m + 1];
            int count[] = new int[m + 1];
            int i = 0;
            int res = 0;
            for (; i < n / 2; ++i) {
                arr[i] = sc.nextInt();
                sum[arr[i]]++;
                count[arr[i]]++;
            }
            for (; i < n; i++) {
                arr[i] = sc.nextInt();
                count[arr[i]]++;
            }
            for(int i1 = 1 ; i1<= m ; i1++) {
                int temp = count[i1]/k;
                if(temp>=sum[i1])
                    res+=sum[i1];
                else if(temp<sum[i1])
                    res+=temp;
            }
            System.out.println(res);
        }
    }
}
}
全部评论

相关推荐

02-18 17:30
腾讯_TEG_技术
多刷**&nbsp;背八股&nbsp;刷面经&nbsp;项目话术准备好&nbsp;不会差的!!!后台看到好多小伙伴们都出现其中一个环节的错误,,,可惜了抓紧机会吧&nbsp;有的是hc&nbsp;但缺的就是稍微用心的人
野猪不是猪🐗:多刷星星,背八股背话术,真的能过你们?对一个个没实习过的学生狂问场景题设计题和底层深挖,别以为我不知道一边说缺人还一边各种kpi面
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
牛客网
牛客企业服务