結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 139 ms
55,488 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++) {
			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) {
					break;
				}
			}
		}
		scan.close();
		System.out.println(key.toString());
	}
}
0