木桶效应,一个数组记录,最小数值即得分
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] ints = new int[n]; for(int i = 0; i < m; i++){ int temp = sc.nextInt(); ints[temp - 1]++; } int min = ints[0]; for(int i = 0; i < n; i++){ if(ints[i] < min){ min = ints[i]; } } System.out.println(min); } }