結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
kenji_shioya
|
| 提出日時 | 2017-01-08 23:59:18 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 5,000 ms |
| コード長 | 1,217 bytes |
| 記録 | |
| コンパイル時間 | 2,529 ms |
| コンパイル使用メモリ | 82,692 KB |
| 実行使用メモリ | 41,576 KB |
| 最終ジャッジ日時 | 2026-05-27 01:06:24 |
| 合計ジャッジ時間 | 3,985 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.*;
public class NumGuess{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] nums = new String[10];
for (int i = 0; i < 10; i++) {
nums[i] = "none";
}
int s = sc.nextInt();
for (int i = 0; i < s; i++) {
int[] ansNums = new int[4];
for (int j = 0; j < 4; j++) {
ansNums[j] = sc.nextInt();
}
String ans = sc.next();
Arrays.sort(ansNums);
if (ans.equals("NO")) {
for (int index : ansNums) {
nums[index] = "false";
}
} else {
for (int j = 0; j < 10; j++) {
if (Arrays.binarySearch(ansNums, j) < 0) {
nums[j] = "false";
} else {
if (!nums[j].equals("false")) {
nums[j] = "true";
}
}
}
}
}
int ans = 0;
int trueIndex = 0;
int noneIndex = 0;
for (int i = 0; i < 10; i++) {
if (nums[i].equals("true")) {
trueIndex = i;
} else if (nums[i].equals("none")) {
noneIndex = i;
}
}
if (trueIndex == 0) {
ans = noneIndex;
} else {
ans = trueIndex;
}
System.out.println(ans);
}
}
kenji_shioya