結果
問題 | No.355 数当てゲーム(2) |
ユーザー | kenji_shioya |
提出日時 | 2016-06-08 09:06:29 |
言語 | Java21 (openjdk 21) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,512 bytes |
コンパイル時間 | 3,988 ms |
コンパイル使用メモリ | 80,328 KB |
実行使用メモリ | 71,984 KB |
平均クエリ数 | 16.63 |
最終ジャッジ日時 | 2024-07-16 10:20:13 |
合計ジャッジ時間 | 16,014 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 186 ms
59,388 KB |
testcase_01 | AC | 189 ms
58,948 KB |
testcase_02 | AC | 169 ms
59,020 KB |
testcase_03 | AC | 180 ms
59,788 KB |
testcase_04 | AC | 167 ms
59,304 KB |
testcase_05 | AC | 167 ms
58,964 KB |
testcase_06 | AC | 174 ms
58,900 KB |
testcase_07 | AC | 168 ms
58,904 KB |
testcase_08 | AC | 174 ms
59,240 KB |
testcase_09 | AC | 174 ms
59,084 KB |
testcase_10 | AC | 171 ms
59,460 KB |
testcase_11 | AC | 176 ms
59,652 KB |
testcase_12 | AC | 175 ms
59,040 KB |
testcase_13 | AC | 165 ms
59,108 KB |
testcase_14 | AC | 178 ms
59,208 KB |
testcase_15 | AC | 181 ms
59,040 KB |
testcase_16 | AC | 170 ms
59,100 KB |
testcase_17 | AC | 172 ms
58,236 KB |
testcase_18 | AC | 168 ms
58,692 KB |
testcase_19 | AC | 181 ms
59,028 KB |
testcase_20 | AC | 181 ms
59,408 KB |
testcase_21 | AC | 170 ms
58,912 KB |
testcase_22 | AC | 180 ms
58,652 KB |
testcase_23 | AC | 163 ms
58,968 KB |
testcase_24 | AC | 167 ms
59,224 KB |
testcase_25 | AC | 174 ms
59,276 KB |
testcase_26 | AC | 175 ms
59,356 KB |
testcase_27 | AC | 166 ms
59,020 KB |
testcase_28 | AC | 167 ms
59,020 KB |
testcase_29 | AC | 196 ms
59,832 KB |
testcase_30 | AC | 178 ms
59,408 KB |
testcase_31 | AC | 168 ms
58,996 KB |
testcase_32 | AC | 172 ms
59,488 KB |
testcase_33 | AC | 180 ms
59,152 KB |
testcase_34 | AC | 195 ms
59,232 KB |
testcase_35 | AC | 170 ms
59,248 KB |
testcase_36 | AC | 178 ms
59,900 KB |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | AC | 166 ms
58,684 KB |
testcase_43 | AC | 192 ms
58,884 KB |
testcase_44 | AC | 191 ms
58,624 KB |
testcase_45 | AC | 169 ms
58,836 KB |
testcase_46 | AC | 166 ms
59,292 KB |
testcase_47 | AC | 178 ms
59,064 KB |
testcase_48 | AC | 199 ms
59,324 KB |
testcase_49 | AC | 184 ms
58,764 KB |
testcase_50 | AC | 190 ms
58,760 KB |
testcase_51 | AC | 185 ms
59,180 KB |
ソースコード
import java.util.*; public class Exercise67{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int[] q = {1, 4, 9, 6}; ArrayList<Integer> confirm = new ArrayList<Integer>(); confirm.add(0); confirm.add(1); confirm.add(2); confirm.add(3); whole: while(true){ System.out.println(q[0] + " " + q[1] + " " + q[2] + " " + q[3]); System.out.flush(); int p = sc.nextInt(); int h = sc.nextInt(); if (p == 4){ break whole; }else if (p + h == 4){ q[confirm.get(confirm.size() - 1)] = changeNum(q[confirm.get(confirm.size() - 1)], q); } for (int i = 0; i < 4; i++){ if (confirm.indexOf(i) == -1){ continue; } int count = 0; eachNum: for (int j = 0; j < 10; j++){ if (checkMN(plus(q[i]), q)){ q[i] = plus(q[i]); count++; continue; }else{ q[i] = plus(q[i]); System.out.println(q[0] + " " + q[1] + " " + q[2] + " " + q[3]); System.out.flush(); int pd = sc.nextInt(); int hd = sc.nextInt(); if (pd == 4){ break whole; }else if(p + 1 == pd){ p = pd; confirm.remove(confirm.indexOf(i)); break eachNum; }else if(p - 1 == pd){ if (q[i] > 0){ q[i] = q[i] - (1 + count); confirm.remove(confirm.indexOf(i)); break eachNum; }else{ q[i] = 9; confirm.remove(confirm.indexOf(i)); break eachNum; } }else if (pd + hd == 4){ q[confirm.get(confirm.size() - 1)] = changeNum(q[confirm.get(confirm.size() - 1)], q); } count = 0; } } } } } private static boolean checkMN(int num, int[] array){ boolean flag = false; for (int i = 0; i < 4; i++){ if (num == array[i]){ flag = true; } } return flag; } private static int plus(int num){ int newNum = 0; if (num < 9){ newNum = num + 1; }else{ newNum = 0; } return newNum; } private static int changeNum(int num, int[] array){ if (checkMN(num, array)){ if (num > 0){ num -= 2; }else{ num = 9; } return changeNum(num, array); }else{ return num; } } }