結果

問題 No.24 数当てゲーム
コンテスト
ユーザー aikon_marimo
提出日時 2018-01-29 00:35:02
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 55 ms / 5,000 ms
+ 192µs
コード長 747 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,443 ms
コンパイル使用メモリ 86,560 KB
実行使用メモリ 45,312 KB
最終ジャッジ日時 2026-10-11 01:49:18
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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