首页 > 其他 > 详细

hdu 1235 统计同成绩学生人数

时间:2017-05-30 18:58:34      阅读:307      评论:0      收藏:0      [点我收藏+]



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 统计同成绩学生人数

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!