結果

問題 No.24 数当てゲーム
ユーザー k_kadorak_kadora
提出日時 2015-05-19 03:13:38
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 660 bytes
コンパイル時間 3,292 ms
コンパイル使用メモリ 77,304 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2024-07-06 05:40:08
合計ジャッジ時間 5,236 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Detect{
	public static void main(String[] arg){
		int[] res = new int[10];
		for(int i = 0;i<10;i++){
			res[i] = 0;
		}
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[4];
		int re=0;
		int count = 0;
		String ans;
		for(int i = 0;i<n;i++){
			for(int j = 0;j<4;j++){
				a[j] = sc.nextInt();
			}
			ans = sc.next();
			if(ans.equals("YES")){
				for(int j=0;j<4;j++){
					res[a[j]] = res[a[j]]+1;
				}
				count++;
			}else{
				for(int j=0;j<4;j++){
					res[a[j]] = res[a[j]]-1;
				}
			}
		}
		for(int i = 0;i<10;i++){
			if(res[i] == count)re = i;
		}
		System.out.println(re);
	}
}
0