結果

問題 No.24 数当てゲーム
ユーザー scache
提出日時 2014-11-15 11:14:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 688 bytes
コンパイル時間 3,495 ms
コンパイル使用メモリ 75,012 KB
実行使用メモリ 54,504 KB
最終ジャッジ日時 2024-12-31 10:55:29
合計ジャッジ時間 5,749 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
/**
 * yukicoder no.24
 * @author scache
 *
 */
public class InferenceNumberGame {
	public static void main(String[] args) {
		InferenceNumberGame p = new InferenceNumberGame();
	}

	public InferenceNumberGame() {
		solve();
	}

	public void solve() {
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		
		int res = 0x3ff;
		for(int i=0;i<n;i++){
			int cur = 0;
			for(int j=0;j<4;j++)
				cur |= 1 << sc.nextInt();
			
			if(sc.next().equals("NO"))
				res &= 0xfff ^ cur;
			else
				res &= cur;
		}
		for(int i=0;i<=9;i++){
			if((res & (1<<i))>0){
				System.out.println(i);
				return ;
			}
		}		
	}
}
0