結果

問題 No.246 質問と回答
ユーザー nCk_cvnCk_cv
提出日時 2015-08-01 13:56:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 2,055 ms
コンパイル使用メモリ 73,668 KB
実行使用メモリ 73,964 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:05:17
合計ジャッジ時間 9,625 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 192 ms
72,032 KB
testcase_01 AC 184 ms
72,288 KB
testcase_02 AC 186 ms
73,964 KB
testcase_03 AC 183 ms
71,696 KB
testcase_04 AC 186 ms
72,080 KB
testcase_05 AC 183 ms
72,028 KB
testcase_06 AC 187 ms
71,916 KB
testcase_07 AC 189 ms
72,144 KB
testcase_08 AC 185 ms
72,212 KB
testcase_09 AC 185 ms
72,288 KB
testcase_10 AC 184 ms
72,200 KB
testcase_11 AC 184 ms
71,664 KB
testcase_12 AC 182 ms
71,712 KB
testcase_13 AC 185 ms
71,808 KB
testcase_14 AC 178 ms
71,960 KB
testcase_15 AC 180 ms
72,212 KB
testcase_16 AC 180 ms
72,352 KB
testcase_17 AC 182 ms
71,932 KB
testcase_18 AC 183 ms
71,708 KB
testcase_19 AC 184 ms
72,196 KB
testcase_20 AC 189 ms
71,956 KB
testcase_21 AC 186 ms
72,496 KB
testcase_22 AC 185 ms
72,180 KB
testcase_23 AC 190 ms
72,116 KB
testcase_24 AC 190 ms
72,340 KB
testcase_25 AC 186 ms
72,468 KB
testcase_26 AC 192 ms
72,192 KB
testcase_27 AC 190 ms
71,664 KB
testcase_28 AC 193 ms
70,132 KB
testcase_29 AC 189 ms
71,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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