結果

問題 No.24 数当てゲーム
ユーザー shinshin
提出日時 2022-05-15 17:58:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 662 bytes
コンパイル時間 3,310 ms
コンパイル使用メモリ 72,644 KB
実行使用メモリ 56,368 KB
最終ジャッジ日時 2023-10-11 03:44:58
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,992 KB
testcase_01 AC 116 ms
56,024 KB
testcase_02 AC 120 ms
55,884 KB
testcase_03 AC 121 ms
56,284 KB
testcase_04 AC 118 ms
56,100 KB
testcase_05 WA -
testcase_06 AC 115 ms
55,944 KB
testcase_07 AC 130 ms
55,800 KB
testcase_08 AC 125 ms
55,744 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No24 {

	public static void main(String[] args) {
		//数当てゲーム
		
		int[] num = new int[10];
		Scanner s = new Scanner(System.in);
		int N = Integer.parseInt(s.nextLine());
		String[] abcd = new String[N];
		
		for(int i = 0;i < N;i++) {
			abcd[i] = s.nextLine();
		}
		s.close();
		
		for(String str : abcd) {
			int d;
			if(str.contains("NO")) {
				d = -1;
			}else {
				d = 1;
			}
			for(int i = 0;i < 4;i++) {
				num[Integer.parseInt(str.split(" ")[i])] += d;
			}
		}
		
		int max = 1;
		for(int i = 1;i < 10;i++) {
			if(num[i] > num[max]) {
				max = i;
			}
		}
		
		System.out.println(max);

	}

}
0