結果

問題 No.24 数当てゲーム
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 15:29:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 636 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 71,212 KB
実行使用メモリ 56,352 KB
最終ジャッジ日時 2023-08-13 16:27:16
合計ジャッジ時間 4,063 ms
ジャッジサーバーID
(参考情報)
judge11 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
55,836 KB
testcase_01 AC 112 ms
55,828 KB
testcase_02 AC 111 ms
55,776 KB
testcase_03 AC 113 ms
55,448 KB
testcase_04 AC 113 ms
55,884 KB
testcase_05 AC 113 ms
55,908 KB
testcase_06 AC 113 ms
55,808 KB
testcase_07 AC 114 ms
56,352 KB
testcase_08 AC 110 ms
56,284 KB
testcase_09 AC 111 ms
55,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[10];
		for(int i = 0 ; i < n ; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int d = sc.nextInt();
			String e = sc.next();
			if(e.equals("YES")) {
				x[a]++; x[b]++; x[c]++; x[d]++;
			} else {
				x[a] -= 100; x[b] -= 100; x[c] -= 100; x[d] -= 100;
			}
		}
		int ans = -1; int point = -1;
		for(int i = 0 ; i < 10 ; i++) {
			if(x[i] > point) {
				ans = i;
				point = x[i];
			}
		}
		System.out.println(ans);
 	}
}

0