zoukankan      html  css  js  c++  java
  • 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);
    		}
    	}
    }
    }
    
  • 相关阅读:
    洛谷-P2430 严酷的训练
    Hackthebox网络不稳定的解决方案
    解压
    谷歌地图API密钥未授权利用
    关于读取heapdump踩的一个小坑
    RECON
    最近思考
    go get
    Js跳转
    Session
  • 原文地址:https://www.cnblogs.com/cznczai/p/11150016.html
Copyright © 2011-2022 走看看