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);
        }
    }
}
}
全部评论

相关推荐

09-24 11:06
辽宁大学 市场
深莞高速因为台风都封掉了,华为协商后,特地开通华为通道,凭工卡可以正常通勤......
崔喃喃:“台风您好,19级专家已驳回了您18级台风的OA登陆申请”
投递华为技术有限公司等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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