結果
問題 | No.355 数当てゲーム(2) |
ユーザー | kenji_shioya |
提出日時 | 2016-06-07 23:48:28 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,533 bytes |
コンパイル時間 | 4,376 ms |
コンパイル使用メモリ | 87,752 KB |
実行使用メモリ | 72,172 KB |
平均クエリ数 | 20.25 |
最終ジャッジ日時 | 2024-07-16 10:18:10 |
合計ジャッジ時間 | 19,260 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | AC | 190 ms
71,296 KB |
testcase_02 | AC | 208 ms
71,684 KB |
testcase_03 | AC | 190 ms
71,560 KB |
testcase_04 | AC | 181 ms
71,040 KB |
testcase_05 | AC | 187 ms
71,068 KB |
testcase_06 | AC | 192 ms
71,636 KB |
testcase_07 | AC | 193 ms
71,460 KB |
testcase_08 | AC | 205 ms
72,140 KB |
testcase_09 | AC | 219 ms
71,992 KB |
testcase_10 | AC | 199 ms
71,424 KB |
testcase_11 | AC | 199 ms
71,624 KB |
testcase_12 | AC | 178 ms
71,344 KB |
testcase_13 | AC | 179 ms
71,284 KB |
testcase_14 | AC | 220 ms
71,424 KB |
testcase_15 | AC | 210 ms
71,560 KB |
testcase_16 | AC | 199 ms
71,600 KB |
testcase_17 | RE | - |
testcase_18 | AC | 224 ms
71,244 KB |
testcase_19 | AC | 201 ms
71,884 KB |
testcase_20 | AC | 207 ms
71,980 KB |
testcase_21 | AC | 209 ms
71,496 KB |
testcase_22 | RE | - |
testcase_23 | AC | 194 ms
71,584 KB |
testcase_24 | AC | 191 ms
71,412 KB |
testcase_25 | AC | 222 ms
71,308 KB |
testcase_26 | AC | 207 ms
71,640 KB |
testcase_27 | AC | 191 ms
71,048 KB |
testcase_28 | AC | 193 ms
71,704 KB |
testcase_29 | AC | 197 ms
71,524 KB |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | AC | 201 ms
72,012 KB |
testcase_33 | AC | 196 ms
71,708 KB |
testcase_34 | AC | 192 ms
71,468 KB |
testcase_35 | AC | 198 ms
71,956 KB |
testcase_36 | RE | - |
testcase_37 | AC | 187 ms
71,080 KB |
testcase_38 | AC | 202 ms
71,856 KB |
testcase_39 | AC | 198 ms
71,672 KB |
testcase_40 | AC | 190 ms
71,112 KB |
testcase_41 | AC | 193 ms
71,808 KB |
testcase_42 | AC | 192 ms
71,896 KB |
testcase_43 | AC | 216 ms
71,740 KB |
testcase_44 | AC | 193 ms
71,668 KB |
testcase_45 | AC | 192 ms
71,660 KB |
testcase_46 | AC | 195 ms
71,544 KB |
testcase_47 | AC | 186 ms
71,312 KB |
testcase_48 | AC | 193 ms
71,440 KB |
testcase_49 | AC | 185 ms
71,616 KB |
testcase_50 | AC | 191 ms
71,232 KB |
testcase_51 | AC | 229 ms
72,056 KB |
ソースコード
import java.util.*; public class Exercise67{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int[] q = {3, 2, 1, 0}; 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){ while(true){ q = shuffleArray(q); System.out.println(q[0] + " " + q[1] + " " + q[2] + " " + q[3]); System.out.flush(); int px = sc.nextInt(); int hx = sc.nextInt(); if (px == 4){ break whole; } } } for (int i = 0; i < 4; i++){ eachNum: for (int j = 0; j < 10; j++){ if (checkMN(plus(q[i]), q)){ q[i] = plus(q[i]); 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; break eachNum; }else if(p - 1 == pd){ if (q[i] > 0){ q[i]--; break eachNum; }else{ q[i] = 9; break eachNum; } }else if (pd + hd == 4){ while(true){ q = shuffleArray(q); System.out.println(q[0] + " " + q[1] + " " + q[2] + " " + q[3]); System.out.flush(); int px = sc.nextInt(); int hx = sc.nextInt(); if (px == 4){ break whole; } } } } } } } } 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){ if (num < 9){ num++; }else{ num = 0; } return num; } private static int[] shuffleArray(int[] array){ ArrayList<Integer> list = new ArrayList<Integer>(); for(int i = 0; i < 4; i++){ list.add(array[i]); } Collections.shuffle(list); for(int i = 0; i < 4; i++){ array[i] = list.get(i); } return array; } }