import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] mat = new int[1001];// 最多仅仅有1000个,浪费1个 int temp = 0, count = 0; while (sc.hasNext()) { int n = sc.nextInt(); if (n == 0) { return; } for (int i = 1; i <= n; i++) { mat[i] = sc.nextInt(); } temp = sc.nextInt(); count = 0; for (int i = 1; i <= n; i++) { if (temp == mat[i]) { count++; } } System.out.println(count); } } }
时间: 2024-10-11 20:44:30