結果

問題 No.246 質問と回答
ユーザー nCk_cvnCk_cv
提出日時 2015-08-01 13:54:48
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 377 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 73,956 KB
実行使用メモリ 73,140 KB
平均クエリ数 72.87
最終ジャッジ日時 2023-09-23 07:24:41
合計ジャッジ時間 10,665 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 192 ms
71,892 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 190 ms
71,740 KB
testcase_08 AC 192 ms
71,980 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 192 ms
71,820 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 193 ms
71,724 KB
testcase_17 AC 188 ms
71,760 KB
testcase_18 AC 188 ms
70,868 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 186 ms
72,432 KB
testcase_26 AC 187 ms
72,620 KB
testcase_27 AC 186 ms
73,140 KB
testcase_28 AC 191 ms
72,076 KB
testcase_29 AC 191 ms
72,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int min = 0;
		int max = 1000000002;
		while(min < max) {
			System.out.println("? " + (min + max)/2);
			int in = sc.nextInt();
			if(in == 1) {
				min = (min + max)/2;
			}
			else {
				max = (min + max)/2-1;
			}
		}
		System.out.println("! " + max);
	}
}
0