結果

問題 No.24 数当てゲーム
ユーザー papipen
提出日時 2017-04-06 18:47:49
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 660 bytes
コンパイル時間 2,890 ms
コンパイル使用メモリ 74,564 KB
実行使用メモリ 41,252 KB
最終ジャッジ日時 2024-07-17 21:26:08
合計ジャッジ時間 4,625 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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