結果

問題 No.24 数当てゲーム
ユーザー spaciaspacia
提出日時 2015-12-19 13:14:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 695 bytes
コンパイル時間 2,297 ms
コンパイル使用メモリ 72,364 KB
実行使用メモリ 49,484 KB
最終ジャッジ日時 2023-10-14 14:18:23
合計ジャッジ時間 2,790 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
49,268 KB
testcase_01 AC 37 ms
49,312 KB
testcase_02 AC 37 ms
49,240 KB
testcase_03 AC 37 ms
49,420 KB
testcase_04 AC 37 ms
49,484 KB
testcase_05 AC 39 ms
49,484 KB
testcase_06 AC 39 ms
49,256 KB
testcase_07 AC 40 ms
49,276 KB
testcase_08 AC 37 ms
49,424 KB
testcase_09 AC 37 ms
49,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main24 {
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] check = new int[10];
		int ans = -1, max = -1;
		
		for (int i = 0; i < n; i++) {
			String[] line = br.readLine().split(" ");
			for (int j = 0; j < line.length - 1; j++) {
				int m = Integer.parseInt(line[j]);
				if (line[4].equals("YES"))
					check[m]++;
				else
					check[m] = -1;
			}
		}
		for (int i = 0; i < check.length; i++) {
			if (max < check[i]) {
				max = check[i];
				ans = i;
			}
		}
		
		System.out.println(ans);
	}
}
0