結果

問題 No.24 数当てゲーム
ユーザー aikon_marimoaikon_marimo
提出日時 2018-01-29 00:35:02
言語 Java19
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 747 bytes
コンパイル時間 3,662 ms
コンパイル使用メモリ 79,312 KB
実行使用メモリ 55,900 KB
最終ジャッジ日時 2023-08-28 14:41:10
合計ジャッジ時間 4,940 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,824 KB
testcase_01 AC 118 ms
55,512 KB
testcase_02 AC 119 ms
55,760 KB
testcase_03 AC 119 ms
55,900 KB
testcase_04 AC 117 ms
55,660 KB
testcase_05 AC 119 ms
55,580 KB
testcase_06 AC 118 ms
55,792 KB
testcase_07 AC 119 ms
55,736 KB
testcase_08 AC 120 ms
55,796 KB
testcase_09 AC 120 ms
55,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int[] score = new int[10];
		Arrays.fill(score, 0);
		
		int N = in.nextInt();
		for (int i = 0; i < N; i++) {
			int A,B,C,D;
			String R;
			
			A = in.nextInt();
			B = in.nextInt();
			C = in.nextInt();
			D = in.nextInt();
			R = in.next();
			if ("NO".equals(R)) {
				score[A]--;
				score[B]--;
				score[C]--;
				score[D]--;
			} else {
				score[A]++;
				score[B]++;
				score[C]++;
				score[D]++;
			}
		}
		int max = score[0];
		int ans = 0;
		for (int i = 1; i <= 9; i++) {
			if (max < score[i]) {
				max = score[i];
				ans = i;
			}
		}
		System.out.println(ans);
	}
}
0