結果
問題 | No.355 数当てゲーム(2) |
ユーザー | TatsuDX |
提出日時 | 2016-10-16 20:52:02 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 203 ms / 2,000 ms |
コード長 | 3,084 bytes |
コンパイル時間 | 4,273 ms |
コンパイル使用メモリ | 79,796 KB |
実行使用メモリ | 72,048 KB |
平均クエリ数 | 23.35 |
最終ジャッジ日時 | 2024-07-17 00:31:16 |
合計ジャッジ時間 | 15,401 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 182 ms
70,960 KB |
testcase_01 | AC | 171 ms
71,912 KB |
testcase_02 | AC | 174 ms
71,648 KB |
testcase_03 | AC | 199 ms
71,884 KB |
testcase_04 | AC | 166 ms
71,460 KB |
testcase_05 | AC | 180 ms
71,540 KB |
testcase_06 | AC | 176 ms
71,268 KB |
testcase_07 | AC | 171 ms
71,304 KB |
testcase_08 | AC | 169 ms
71,488 KB |
testcase_09 | AC | 187 ms
71,952 KB |
testcase_10 | AC | 186 ms
71,240 KB |
testcase_11 | AC | 186 ms
71,804 KB |
testcase_12 | AC | 187 ms
71,648 KB |
testcase_13 | AC | 177 ms
71,328 KB |
testcase_14 | AC | 165 ms
72,048 KB |
testcase_15 | AC | 188 ms
71,336 KB |
testcase_16 | AC | 165 ms
71,640 KB |
testcase_17 | AC | 193 ms
71,328 KB |
testcase_18 | AC | 167 ms
71,600 KB |
testcase_19 | AC | 181 ms
71,512 KB |
testcase_20 | AC | 175 ms
71,748 KB |
testcase_21 | AC | 181 ms
71,584 KB |
testcase_22 | AC | 192 ms
71,524 KB |
testcase_23 | AC | 162 ms
71,844 KB |
testcase_24 | AC | 168 ms
71,236 KB |
testcase_25 | AC | 190 ms
71,488 KB |
testcase_26 | AC | 196 ms
71,432 KB |
testcase_27 | AC | 169 ms
71,532 KB |
testcase_28 | AC | 171 ms
71,792 KB |
testcase_29 | AC | 184 ms
71,292 KB |
testcase_30 | AC | 178 ms
71,276 KB |
testcase_31 | AC | 179 ms
71,912 KB |
testcase_32 | AC | 194 ms
71,920 KB |
testcase_33 | AC | 177 ms
71,124 KB |
testcase_34 | AC | 201 ms
72,044 KB |
testcase_35 | AC | 173 ms
71,688 KB |
testcase_36 | AC | 184 ms
71,712 KB |
testcase_37 | AC | 193 ms
71,920 KB |
testcase_38 | AC | 193 ms
71,764 KB |
testcase_39 | AC | 190 ms
71,744 KB |
testcase_40 | AC | 178 ms
71,364 KB |
testcase_41 | AC | 199 ms
71,848 KB |
testcase_42 | AC | 166 ms
71,752 KB |
testcase_43 | AC | 171 ms
71,572 KB |
testcase_44 | AC | 202 ms
71,728 KB |
testcase_45 | AC | 195 ms
71,936 KB |
testcase_46 | AC | 165 ms
71,364 KB |
testcase_47 | AC | 203 ms
71,612 KB |
testcase_48 | AC | 189 ms
71,616 KB |
testcase_49 | AC | 170 ms
71,616 KB |
testcase_50 | AC | 171 ms
71,448 KB |
testcase_51 | AC | 165 ms
71,496 KB |
ソースコード
import java.util.Arrays; import java.util.Scanner; public class Test { public static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int idx = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) continue; for (int k = 0; k < 4; k++) { if (i == k) continue; if (j == k) continue; for (int l = 0; l < 4; l++) { if (i == l) continue; if (j == l) continue; if (k == l) continue; p[idx][0] = i; p[idx][1] = j; p[idx][2] = k; p[idx][3] = l; idx++; } } } } chk(); } public static int[] b = new int[4]; public static int[] c = new int[4]; public static boolean[] t = new boolean[10]; public static int[][] p = new int[24][4]; public static void chk() { int hit, blw; for (b[0] = 0; b[0] < 7; b[0]++) { for (b[1] = b[0] + 1; b[1] < 8; b[1]++) { for (b[2] = b[1] + 1; b[2] < 9; b[2]++) { for (b[3] = b[2] + 1; b[3] < 10; b[3]++) { System.out.println(b[0] +" "+ b[1] +" "+ b[2] +" "+ b[3]); hit = sc.nextInt(); blw = sc.nextInt(); if (hit == 4) { return; } else if (hit + blw == 4) { chk4(); return; } else if (hit + blw == 3) { Arrays.fill(t, false); chk3(); return; } else if (hit + blw == 0) { Arrays.fill(t, false); chk0(); return; } } } } } } public static void chk0() { int hit, blw; for (int i = 0; i < 4; i++) { c[i] = b[i]; t[b[i]] = true; } for (b[0] = c[0] + 1; b[0] < 7; b[0]++) { if (t[b[0]]) continue; for (b[1] = b[0] + 1; b[1] < 8; b[1]++) { if (t[b[1]]) continue; for (b[2] = b[1] + 1; b[2] < 9; b[2]++) { if (t[b[2]]) continue; for (b[3] = b[2] + 1; b[3] < 10; b[3]++) { if (t[b[3]]) continue; System.out.println(b[0] +" "+ b[1] +" "+ b[2] +" "+ b[3]); hit = sc.nextInt(); blw = sc.nextInt(); if (hit == 4) { return; } else if (hit + blw == 4) { chk4(); return; } else if (hit + blw == 3) { chk3(); return; } } } } } } public static void chk3() { int hit, blw; for (int i = 0; i < 4; i++) { c[i] = b[i]; t[c[i]] = true; } for (int i = 0; i < 4; i++) { for (int j = c[i] + 1; j < 10; j++) { if (t[j]) continue; b[i] = j; System.out.println(b[0] +" "+ b[1] +" "+ b[2] +" "+ b[3]); hit = sc.nextInt(); blw = sc.nextInt(); if (hit == 4) { return; } else if (hit + blw == 4) { chk4(); return; } else if (hit + blw == 2) { break; } } b[i] = c[i]; } } public static void chk4() { int hit, blw; for (int i = 0; i < 4; i++) { c[i] = b[i]; } for (int i = 1; i < 24; i++) { for (int j = 0; j < 4; j++) { b[j] = c[p[i][j]]; } System.out.println(b[0] +" "+ b[1] +" "+ b[2] +" "+ b[3]); hit = sc.nextInt(); blw = sc.nextInt(); if (hit == 4) { return; } } } }