結果

問題 No.2768 Password Crack
ユーザー ks2mks2m
提出日時 2024-05-31 22:20:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 679 bytes
コンパイル時間 2,959 ms
コンパイル使用メモリ 76,448 KB
実行使用メモリ 76,420 KB
平均クエリ数 1785.17
最終ジャッジ日時 2024-05-31 22:20:40
合計ジャッジ時間 18,632 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
70,544 KB
testcase_01 AC 147 ms
69,836 KB
testcase_02 AC 441 ms
76,420 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 236 ms
71,564 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 342 ms
73,108 KB
testcase_27 WA -
testcase_28 AC 276 ms
71,928 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		char[] a = new char[n];
		Arrays.fill(a, 'a');
		for (int i = 0; i < n; i++) {
			int[] cnt = new int[25];
			for (int j = 0; j < 25; j++) {
				char c = (char) ('a' + j);
				a[i] = c;
				System.out.println("? " + String.valueOf(a));
				cnt[j] = sc.nextInt();
			}
			int j2 = 25;
			for (int j = 1; j < 25; j++) {
				if (cnt[j] != cnt[0]) {
					j2 = j;
					break;
				}
			}
			a[i] = (char) ('a' + j2);
		}
		System.out.println("! " + String.valueOf(a));
		sc.close();
	}
}
0