結果

問題 No.246 質問と回答
ユーザー suiginginsuigingin
提出日時 2015-07-19 21:41:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 3,549 ms
コンパイル使用メモリ 73,992 KB
実行使用メモリ 74,272 KB
平均クエリ数 31.00
最終ジャッジ日時 2023-09-23 20:01:35
合計ジャッジ時間 11,788 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 202 ms
72,276 KB
testcase_01 AC 201 ms
71,548 KB
testcase_02 AC 201 ms
72,120 KB
testcase_03 AC 199 ms
72,320 KB
testcase_04 AC 199 ms
72,184 KB
testcase_05 AC 200 ms
72,052 KB
testcase_06 AC 199 ms
71,912 KB
testcase_07 AC 199 ms
74,272 KB
testcase_08 AC 200 ms
72,260 KB
testcase_09 AC 204 ms
73,084 KB
testcase_10 AC 207 ms
72,520 KB
testcase_11 AC 195 ms
72,272 KB
testcase_12 AC 200 ms
72,076 KB
testcase_13 AC 199 ms
71,676 KB
testcase_14 AC 200 ms
71,400 KB
testcase_15 AC 197 ms
72,220 KB
testcase_16 AC 198 ms
72,548 KB
testcase_17 AC 198 ms
71,688 KB
testcase_18 AC 197 ms
72,348 KB
testcase_19 AC 201 ms
72,012 KB
testcase_20 AC 198 ms
71,840 KB
testcase_21 AC 200 ms
72,172 KB
testcase_22 AC 203 ms
72,024 KB
testcase_23 AC 200 ms
71,960 KB
testcase_24 AC 203 ms
73,908 KB
testcase_25 AC 203 ms
72,776 KB
testcase_26 AC 201 ms
72,516 KB
testcase_27 AC 201 ms
72,544 KB
testcase_28 AC 201 ms
71,784 KB
testcase_29 AC 205 ms
70,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No_246 {
	Scanner sc = new Scanner(System.in);
	int M = 1000000000;

	void run() {
		int l = 0;
		int r = M + 1;
		for (int i = 0; i < 30; i++) {
			int mid = (l + r) / 2;
			System.out.println("? " + mid);
			int ans = sc.nextInt();
			if (ans == 1) l = mid;
			else r = mid;
			
		}
		System.out.println("! " + l);
	}

	public static void main(String[] args) {
		new No_246().run();
	}
}
0