SWEA_D3_6913_동철이의 프로그래밍 대회

SWEA

6913. 동철이의 프로그래밍 대회

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Solution {
	static int T, N, M, MAX, cnt;
	static int score[];

	static StringTokenizer st;

	public static void main(String[] args) throws Exception {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		T = Integer.parseInt(in.readLine().trim());
		for (int test_case = 1; test_case <= T; test_case++) {
			st = new StringTokenizer(in.readLine());

			N = Integer.parseInt(st.nextToken());
			M = Integer.parseInt(st.nextToken());

			score = new int[N + 1];

			MAX = -1;

			for (int i = 1; i <= N; i++) {
				st = new StringTokenizer(in.readLine());
				for (int j = 0; j < M; j++) {
					if (Integer.parseInt(st.nextToken()) == 1) {
						score[i]++;
					}
				}
				MAX = Math.max(MAX, score[i]);
			}
			cnt = 0;
			for(int i=1; i<=N; i++) {
				if(score[i] == MAX) {
					cnt++;
				}
			}
			System.out.println("#"+test_case+" "+cnt+" "+MAX);
		}
	}
}


© 2019. All rights reserved.

Powered by Hydejack v8.4.0