张懿林


私信TA

用户名:a294372504

访问量:1598

签 名:

等  级
排  名 905
经  验 3374
参赛次数 0
文章发表 11
年  龄 0
在职情况 学生
学  校 湖北生物科技职业学院
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


public class test1521 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int count=sc.nextInt();
		Map<Integer, Integer> map=new HashMap<Integer, Integer>();
		
		for (int i = 0; i < 7; i++) {
			int y=sc.nextInt();
			map.put(y,y);
		}
		int[] sum=new int[count];
		for (int i = 0; i < count; i++) {
			for (int j = 0; j < 7; j++) {
				int num=sc.nextInt();
				if (map.containsKey(num)) {
					sum[i]++;
				}
			}
		}
		int[] res={0,0,0,0,0,0,0};
		for (int i = 0; i < sum.length; i++) {
			for (int j = 0; j < 7; j++) {
				if (sum[i]==j+1) {
					res[j]++;
				}
			}
		}
		for (int i = 7-1; i >= 0; i--) {
			System.out.print(res[i]+" ");
		}
	}
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区