結果

問題 No.24 数当てゲーム
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-11 01:56:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,135 bytes
コンパイル時間 3,479 ms
コンパイル使用メモリ 77,740 KB
実行使用メモリ 52,068 KB
最終ジャッジ日時 2024-04-28 15:34:14
合計ジャッジ時間 4,897 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 = 0;
		int max = 0;
		for(int i=0; i < a.length; i++){
			if(max < a[i]){
				max = a[i];
				ans = i;
			}
		}
		return ans;
	}
}
0