結果

問題 No.24 数当てゲーム
ユーザー shinshin
提出日時 2022-05-15 17:59:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 4,566 ms
コンパイル使用メモリ 73,296 KB
実行使用メモリ 56,428 KB
最終ジャッジ日時 2023-10-11 03:47:39
合計ジャッジ時間 5,191 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,848 KB
testcase_01 AC 116 ms
56,012 KB
testcase_02 AC 116 ms
56,328 KB
testcase_03 AC 117 ms
55,924 KB
testcase_04 AC 119 ms
56,076 KB
testcase_05 AC 119 ms
56,428 KB
testcase_06 AC 116 ms
56,212 KB
testcase_07 AC 116 ms
56,372 KB
testcase_08 AC 115 ms
54,028 KB
testcase_09 AC 115 ms
56,156 KB
権限があれば一括ダウンロードができます

ソースコード

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 = 0;
		for(int i = 1;i < 10;i++) {
			if(num[i] > num[max]) {
				max = i;
			}
		}
		
		System.out.println(max);

	}

}
0