码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 1235 统计同成绩学生人数

时间:2017-05-30 19:25:13      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:imp   new   成绩   hdu   for   data-   pop   str   print   



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);
		}
	}

}







hdu 1235 统计同成绩学生人数

标签:imp   new   成绩   hdu   for   data-   pop   str   print   

原文地址:http://www.cnblogs.com/jhcelue/p/6920806.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!