結果

問題 No.24 数当てゲーム
ユーザー jp_stejp_ste
提出日時 2016-02-19 09:15:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 753 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 74,748 KB
実行使用メモリ 57,676 KB
最終ジャッジ日時 2023-10-23 18:24:42
合計ジャッジ時間 3,992 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,256 KB
testcase_01 AC 127 ms
57,612 KB
testcase_02 AC 129 ms
57,284 KB
testcase_03 AC 130 ms
57,584 KB
testcase_04 AC 131 ms
57,540 KB
testcase_05 AC 129 ms
57,244 KB
testcase_06 AC 126 ms
57,296 KB
testcase_07 AC 130 ms
57,576 KB
testcase_08 AC 128 ms
57,556 KB
testcase_09 AC 132 ms
57,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scan = new Scanner(System.in)) {
			int N = scan.nextInt();
			boolean isNo[] = new boolean[10];
			
			for(int i=0; i<N; i++) {
				int v1 = scan.nextInt();
				int v2 = scan.nextInt();
				int v3 = scan.nextInt();
				int v4 = scan.nextInt();
				String s = scan.next();
				
				if(s.equals("YES")) {
					for(int j=0; j<10; j++) {
						if(j == v1 || j == v2 || j == v3 || j == v4) continue;
						isNo[j] = true;
					}
					
				} else if(s.equals("NO")) {
					isNo[v1] = isNo[v2] = isNo[v3] = isNo[v4] = true;
				}
			}
			
			for(int i=0; i<10; i++) {
				if(isNo[i] == false) {
					System.out.println(i);
					break;
				}
			}
		}
	}
}
0