結果

問題 No.24 数当てゲーム
ユーザー omc-testomc-test
提出日時 2016-08-05 13:29:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 774 bytes
コンパイル時間 2,867 ms
コンパイル使用メモリ 76,680 KB
実行使用メモリ 36,996 KB
最終ジャッジ日時 2024-04-24 15:37:12
合計ジャッジ時間 3,894 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
36,772 KB
testcase_01 AC 44 ms
36,864 KB
testcase_02 AC 46 ms
36,996 KB
testcase_03 AC 44 ms
36,924 KB
testcase_04 AC 44 ms
36,920 KB
testcase_05 AC 43 ms
36,788 KB
testcase_06 AC 46 ms
36,788 KB
testcase_07 AC 46 ms
36,496 KB
testcase_08 AC 44 ms
36,880 KB
testcase_09 AC 45 ms
36,852 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