結果

問題 No.24 数当てゲーム
ユーザー bigbear90560bigbear90560
提出日時 2015-09-17 18:50:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 965 bytes
コンパイル時間 3,437 ms
コンパイル使用メモリ 72,904 KB
実行使用メモリ 56,012 KB
最終ジャッジ日時 2023-09-26 12:23:11
合計ジャッジ時間 5,459 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,884 KB
testcase_01 AC 125 ms
55,724 KB
testcase_02 AC 126 ms
55,676 KB
testcase_03 AC 126 ms
55,960 KB
testcase_04 AC 123 ms
55,632 KB
testcase_05 AC 124 ms
55,804 KB
testcase_06 AC 125 ms
55,780 KB
testcase_07 AC 126 ms
55,680 KB
testcase_08 AC 124 ms
55,696 KB
testcase_09 AC 127 ms
56,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

/**
 * No.24 数当てゲーム
 */
public class No024_NumberHitGame {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();	// 入力列数

        int[] judge = new int[10];
        for (int i=0; i<a; i++) {
        	int n1 = sc.nextInt();	// 数1
        	int n2 = sc.nextInt();	// 数2
        	int n3 = sc.nextInt();	// 数3
        	int n4 = sc.nextInt();	// 数4
            String s = sc.next();	// ジャッジ

            judge[n1] += "YES".equals(s) ? 1 : -1; 
            judge[n2] += "YES".equals(s) ? 1 : -1; 
            judge[n3] += "YES".equals(s) ? 1 : -1; 
            judge[n4] += "YES".equals(s) ? 1 : -1; 
        }

        int max = -1;
        int result = 0;
        for (int i=0; i<judge.length; i++) {
        	if (max < judge[i]) {
        		max = judge[i];
        		result = i;
        	}
        }
        System.out.println(result);
	}

}
0