結果

問題 No.24 数当てゲーム
ユーザー papipenpapipen
提出日時 2017-04-06 18:47:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 660 bytes
コンパイル時間 3,837 ms
コンパイル使用メモリ 72,064 KB
実行使用メモリ 55,892 KB
最終ジャッジ日時 2023-09-24 20:57:58
合計ジャッジ時間 5,129 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,420 KB
testcase_01 AC 130 ms
55,844 KB
testcase_02 AC 129 ms
55,840 KB
testcase_03 AC 130 ms
55,892 KB
testcase_04 AC 129 ms
55,768 KB
testcase_05 AC 130 ms
55,848 KB
testcase_06 AC 128 ms
55,732 KB
testcase_07 AC 131 ms
55,460 KB
testcase_08 AC 128 ms
55,688 KB
testcase_09 AC 129 ms
55,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class N024{
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int e[] = new int[10];
		int count;
		for(int i = 0; i < n; i++){
			int a = s.nextInt();
			int b = s.nextInt();
			int c = s.nextInt();
			int d = s.nextInt();
			String r = s.next();
			if(r.equals("YES")){
				count = 1;
			}else{
				count = -1;
			}
				e[a] += count;
				e[b] += count;
				e[c] += count;
				e[d] += count;
		}
		
		int max = 0;
		for(int i = 0; i < e.length; i++){;
			max = Math.max(max , e[i]);
		}
		for(int i = 0; i < e.length; i++){
			if(e[i] == max){
				System.out.println(i);
			}
		}
	}
}
0