結果

問題 No.24 数当てゲーム
ユーザー omc-testomc-test
提出日時 2016-08-05 13:29:33
言語 Java19
(openjdk 21)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 774 bytes
コンパイル時間 3,297 ms
コンパイル使用メモリ 73,992 KB
実行使用メモリ 49,504 KB
最終ジャッジ日時 2023-08-06 21:05:08
合計ジャッジ時間 4,520 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,384 KB
testcase_01 AC 45 ms
49,188 KB
testcase_02 AC 44 ms
49,296 KB
testcase_03 AC 45 ms
49,172 KB
testcase_04 AC 44 ms
49,292 KB
testcase_05 AC 45 ms
49,208 KB
testcase_06 AC 45 ms
49,128 KB
testcase_07 AC 45 ms
49,224 KB
testcase_08 AC 44 ms
49,504 KB
testcase_09 AC 45 ms
49,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class No0024 {
	public static void main(String[] args){
		int val[] = new int[10];
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
			int n = Integer.parseInt(br.readLine());
			for(int i=0; i<n; i++){
				String str = br.readLine();
				String res[] = str.split(" ", -1);
				for(int j=0; j<4; j++){
					if(res[4].equals("YES")){
						val[Integer.parseInt(res[j])]++;
					}else{
						val[Integer.parseInt(res[j])]--;
					}
				}
			}
		}catch (IOException e){
			e.printStackTrace();
		}
		int ans = 0;
		for(int i=1, buf=val[0]; i<10; i++){
			if(val[i] > buf){
				buf = val[i];
				ans = i;
			}
		}
		System.out.println(ans);
	}
}
0