参考代码:
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n=scanner.nextInt(); int num[]=new int [8]; HashMap<Integer, Integer> mmMap=new HashMap<Integer, Integer>(); for (int i = 0; i < 7; i++) { int h=scanner.nextInt(); mmMap.put(h, h); } for (int i = 0; i < n; i++) { int count=0; for (int j = 0; j < 7; j++) { int h1=scanner.nextInt(); if (mmMap.containsKey(h1)) { count++; } } num[count]++; } for (int i = num.length-1; i >=1 ; i--) { System.out.print(num[i]+" "); } } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:669 |
数组输出 (C语言代码)浏览:767 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:896 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:869 |
WU-判定字符位置 (C++代码)浏览:1395 |
Tom数 (C语言代码)浏览:552 |
数组输出 (C语言代码)浏览:700 |
输出九九乘法表 (C语言代码)浏览:1048 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:463 |
敲七 (C++代码)浏览:1051 |