結果

問題 No.305 鍵(2)
ユーザー YamaKasaYamaKasa
提出日時 2018-09-10 22:15:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 72,988 KB
実行使用メモリ 74,212 KB
平均クエリ数 21.62
最終ジャッジ日時 2023-09-23 16:19:42
合計ジャッジ時間 7,189 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
69,720 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 137 ms
55,316 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		StringBuilder key = new StringBuilder("0000000000");
		System.out.println(key.toString());
		int X = scan.nextInt();
		String t = scan.next();
		if(t.equals("unlocked")) {
			System.exit(0);
		}
		for(int i = 0; i < 10; i++) {
			String s0 = key.toString();
			for(int j = 1; j < 10; j++) {
				String s = key.replace(i, i + 1, Integer.toString(j)).toString();
				System.out.println(s);
				int k = scan.nextInt();
				t = scan.next();
				if(t.equals("unlocked")) {
					System.exit(0);
				}
				if(k > X) {
					key = new StringBuilder(s);
					break;
				}else if(k < X) {
					key = new StringBuilder(s0);
					break;
				}
			}
		}
		scan.close();
	}
}
0