結果
問題 | No.355 数当てゲーム(2) |
ユーザー | kenji_shioya |
提出日時 | 2016-06-07 23:49:24 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,533 bytes |
コンパイル時間 | 4,151 ms |
コンパイル使用メモリ | 84,900 KB |
実行使用メモリ | 73,448 KB |
平均クエリ数 | 19.44 |
最終ジャッジ日時 | 2024-07-16 10:19:54 |
合計ジャッジ時間 | 16,523 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | AC | 167 ms
58,632 KB |
testcase_02 | AC | 168 ms
58,636 KB |
testcase_03 | AC | 164 ms
58,848 KB |
testcase_04 | AC | 167 ms
58,908 KB |
testcase_05 | AC | 174 ms
59,276 KB |
testcase_06 | AC | 168 ms
58,728 KB |
testcase_07 | AC | 175 ms
59,016 KB |
testcase_08 | AC | 191 ms
59,136 KB |
testcase_09 | AC | 176 ms
59,580 KB |
testcase_10 | AC | 175 ms
58,492 KB |
testcase_11 | AC | 197 ms
59,792 KB |
testcase_12 | AC | 172 ms
59,092 KB |
testcase_13 | AC | 177 ms
59,836 KB |
testcase_14 | AC | 176 ms
59,524 KB |
testcase_15 | AC | 183 ms
59,436 KB |
testcase_16 | AC | 189 ms
59,532 KB |
testcase_17 | RE | - |
testcase_18 | AC | 191 ms
58,936 KB |
testcase_19 | AC | 163 ms
58,268 KB |
testcase_20 | AC | 171 ms
59,508 KB |
testcase_21 | AC | 170 ms
59,504 KB |
testcase_22 | RE | - |
testcase_23 | AC | 190 ms
59,012 KB |
testcase_24 | AC | 167 ms
59,248 KB |
testcase_25 | AC | 199 ms
58,752 KB |
testcase_26 | AC | 177 ms
59,488 KB |
testcase_27 | AC | 178 ms
58,656 KB |
testcase_28 | AC | 164 ms
58,632 KB |
testcase_29 | AC | 182 ms
58,592 KB |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | AC | 172 ms
59,308 KB |
testcase_33 | AC | 174 ms
59,312 KB |
testcase_34 | AC | 179 ms
59,264 KB |
testcase_35 | AC | 166 ms
58,964 KB |
testcase_36 | RE | - |
testcase_37 | AC | 178 ms
59,152 KB |
testcase_38 | AC | 175 ms
59,156 KB |
testcase_39 | AC | 184 ms
59,644 KB |
testcase_40 | AC | 171 ms
59,700 KB |
testcase_41 | AC | 173 ms
58,676 KB |
testcase_42 | AC | 169 ms
59,404 KB |
testcase_43 | AC | 179 ms
58,756 KB |
testcase_44 | AC | 168 ms
58,952 KB |
testcase_45 | AC | 179 ms
59,064 KB |
testcase_46 | AC | 204 ms
59,624 KB |
testcase_47 | AC | 178 ms
58,552 KB |
testcase_48 | AC | 164 ms
58,776 KB |
testcase_49 | AC | 167 ms
59,292 KB |
testcase_50 | AC | 170 ms
58,748 KB |
testcase_51 | AC | 186 ms
58,852 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; } }