結果

問題 No.24 数当てゲーム
ユーザー kano_townkano_town
提出日時 2014-11-20 00:41:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 3,499 ms
コンパイル使用メモリ 74,408 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-08-30 21:54:28
合計ジャッジ時間 5,192 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,296 KB
testcase_01 AC 118 ms
56,056 KB
testcase_02 AC 115 ms
55,480 KB
testcase_03 AC 115 ms
55,760 KB
testcase_04 AC 113 ms
56,260 KB
testcase_05 AC 111 ms
56,060 KB
testcase_06 AC 119 ms
55,856 KB
testcase_07 AC 119 ms
56,108 KB
testcase_08 AC 115 ms
55,840 KB
testcase_09 AC 118 ms
55,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Yukicoder24 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a, b, c, d, max = -100, index = 0;
		
		int[] num = new int[10];
		Arrays.fill(num, 0);
			
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			d = sc.nextInt();
			if (sc.next().equals("NO")) {
				num[a] = -100;
				num[b] = -100;
				num[c] = -100;
				num[d] = -100;
			} else {
				num[a]++;
				num[b]++;
				num[c]++;
				num[d]++;
			}
		}
		
		for (int i = 0; i < 10; i++) {
			if (max < num[i]) {
				max = num[i];
				index = i;
			}
		}
		
		System.out.println(index);
	}
}
0