結果

問題 No.24 数当てゲーム
ユーザー jimanojimano
提出日時 2016-07-18 17:24:08
言語 Java19
(openjdk 21)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 1,055 bytes
コンパイル時間 3,237 ms
コンパイル使用メモリ 74,348 KB
実行使用メモリ 49,460 KB
最終ジャッジ日時 2023-08-05 19:54:12
合計ジャッジ時間 4,468 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,224 KB
testcase_01 AC 45 ms
49,256 KB
testcase_02 AC 44 ms
49,220 KB
testcase_03 AC 44 ms
49,240 KB
testcase_04 AC 45 ms
49,072 KB
testcase_05 AC 46 ms
49,060 KB
testcase_06 AC 47 ms
49,460 KB
testcase_07 AC 46 ms
49,260 KB
testcase_08 AC 45 ms
49,084 KB
testcase_09 AC 44 ms
49,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0024 {
	public static void main(String[] args) {
		try (BufferedReader br = 
				new BufferedReader(new InputStreamReader(System.in))) {
	        int cntTurn = Integer.parseInt(br.readLine());
	        String[] str;
	        int[] num = new int[10];

		    for(int i =0; i < cntTurn ; i++){
		    	str = br.readLine().trim().split(" ");
		    	if(str[str.length - 1].endsWith("NO")){
		    		for(int j = 0; j < str.length - 1; j++){
		    			num[Integer.parseInt(str[j])] = -1;//リセット
		    		}
		    	}
		    	else if(str[str.length - 1].endsWith("YES")){
		    		for(int j = 0; j < str.length - 1; j++){
		    			num[Integer.parseInt(str[j])] += 1;
		    		}
		    	}
		    }
		    int max = 0;
		    for(int n:num){
		    	max = Math.max(max, n);
		    }
		    for(int i = 0; i < num.length ; i++){
		    	if(num[i] == max){
		    		System.out.println(i);
		    	}
		    }
		} catch (IOException e) {
			e.printStackTrace();
		}
    }
}
0