結果

問題 No.24 数当てゲーム
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-26 17:55:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 824 bytes
コンパイル時間 3,529 ms
コンパイル使用メモリ 77,824 KB
実行使用メモリ 41,824 KB
最終ジャッジ日時 2024-04-16 17:31:11
合計ジャッジ時間 5,534 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,636 KB
testcase_01 AC 128 ms
41,248 KB
testcase_02 AC 131 ms
41,444 KB
testcase_03 AC 134 ms
41,792 KB
testcase_04 AC 132 ms
41,484 KB
testcase_05 AC 129 ms
41,732 KB
testcase_06 AC 136 ms
41,508 KB
testcase_07 AC 135 ms
41,824 KB
testcase_08 AC 134 ms
41,364 KB
testcase_09 AC 132 ms
41,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Yuki24_{
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int arr[][] = new int[num][4];
		String[] ans = new String[num];
		int numbers[] = new int[10];
		
		for (int i = 0; i < num; i++ ) {
			for (int j = 0; j < 4; j++ ) {
				arr[i][j] = scan.nextInt();
			}
			ans[i] = scan.next(); 
		}
		scan.close();
		
		for (int i = 0; i < num; i++ ) {
			for (int j = 0; j < 4; j++ ) {
				if("YES".equals(ans[i])){
					numbers[arr[i][j]] += 1;
				}
				if("NO".equals(ans[i])){
					numbers[arr[i][j]] -= 1;
				}
			}
		}
		int answer = 0;
		int jug = 0;
		for(int i = 0 ;i <= 9; i++ ) {
			if(jug <= numbers[i]){
				answer = i;
				jug = numbers[i];
			}
		}
		System.out.println(answer);	
	}
}
0