結果

問題 No.24 数当てゲーム
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-11 01:32:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,100 bytes
コンパイル時間 3,436 ms
コンパイル使用メモリ 77,704 KB
実行使用メモリ 50,412 KB
最終ジャッジ日時 2024-04-28 15:33:07
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
50,044 KB
testcase_01 AC 57 ms
50,412 KB
testcase_02 AC 55 ms
49,988 KB
testcase_03 AC 54 ms
50,292 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 53 ms
50,144 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No24{
	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int turn = Integer.parseInt(br.readLine());
			kazuate(br, turn);
		}
		catch(IOException e){
			e.getStackTrace();
		}
		catch(NumberFormatException e){
			e.getStackTrace();
		}
	}
	
	public static void kazuate(BufferedReader br, int n) throws IOException, NumberFormatException{
		int[] jiroThought = new int[10];
		int[] taroSuggest = new int[4];
		for(int i=0; i < n; i++){
			String[] str = br.readLine().split(" ");
			for(int j=0; j < 4; j++)
				taroSuggest[j] = Integer.parseInt(str[j]);
			for(int k=0; k < 4; k++){
				if(str[4].equals("YES")) jiroThought[taroSuggest[k]]++;
			    else if (str[4].equals("NO")) jiroThought[taroSuggest[k]]--;
			}
		}
		System.out.println(getIndex(jiroThought));
	}
	
	public static int getIndex(int[] a){
		int ans = a[0];
		for(int i=0; i < a.length; i++){
			if(a[i] > ans)
				ans = i;
		}
		return ans;
	}
}
0