結果

問題 No.24 数当てゲーム
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-12 00:25:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,225 bytes
コンパイル時間 3,321 ms
コンパイル使用メモリ 77,336 KB
実行使用メモリ 52,100 KB
最終ジャッジ日時 2024-04-28 16:23:36
合計ジャッジ時間 3,804 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
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));
		System.out.println(" ");
		for(int hako:jiroThought){
			System.out.println(hako);
		}
		}
	
	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