結果

問題 No.24 数当てゲーム
ユーザー jp_stejp_ste
提出日時 2016-02-19 09:06:25
言語 Java19
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 838 bytes
コンパイル時間 3,085 ms
コンパイル使用メモリ 77,324 KB
実行使用メモリ 57,624 KB
最終ジャッジ日時 2023-10-23 18:24:19
合計ジャッジ時間 5,516 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,472 KB
testcase_01 AC 130 ms
57,508 KB
testcase_02 AC 127 ms
57,624 KB
testcase_03 AC 130 ms
57,084 KB
testcase_04 AC 130 ms
57,308 KB
testcase_05 AC 128 ms
57,528 KB
testcase_06 AC 128 ms
57,328 KB
testcase_07 AC 131 ms
57,324 KB
testcase_08 AC 130 ms
57,388 KB
testcase_09 AC 132 ms
57,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scan = new Scanner(System.in)) {
			int N = scan.nextInt();
			boolean isNo[] = new boolean[10];
			int count[] = new int [10];
			
			for(int i=0; i<N; i++) {
				int v1 = scan.nextInt();
				int v2 = scan.nextInt();
				int v3 = scan.nextInt();
				int v4 = scan.nextInt();
				String s = scan.next();
				
				if(s.equals("YES")) {
					count[v1]++;
					count[v2]++;
					count[v3]++;
					count[v4]++;
					
				} else if(s.equals("NO")) {
					isNo[v1] = isNo[v2] = isNo[v3] = isNo[v4] = true;
				}
			}
			
			int max = 0;
			for(int i=0; i<10; i++) {
				max = Math.max(max, count[i]);
			}
			for(int i=0; i<10; i++) {
				if(count[i] == max && isNo[i] == false) {
					System.out.println(i);
					break;
				}
			}
		}
	}
}
0