結果

問題 No.246 質問と回答
ユーザー ぴろずぴろず
提出日時 2015-07-17 22:24:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 73,824 KB
実行使用メモリ 72,924 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 19:49:15
合計ジャッジ時間 9,328 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 189 ms
71,956 KB
testcase_01 AC 183 ms
71,876 KB
testcase_02 AC 184 ms
71,628 KB
testcase_03 AC 181 ms
72,360 KB
testcase_04 AC 181 ms
72,272 KB
testcase_05 AC 178 ms
72,016 KB
testcase_06 AC 183 ms
69,948 KB
testcase_07 AC 183 ms
72,204 KB
testcase_08 AC 178 ms
71,640 KB
testcase_09 AC 179 ms
71,708 KB
testcase_10 AC 177 ms
72,924 KB
testcase_11 AC 182 ms
71,632 KB
testcase_12 AC 179 ms
71,940 KB
testcase_13 AC 183 ms
71,932 KB
testcase_14 AC 182 ms
72,172 KB
testcase_15 AC 180 ms
72,176 KB
testcase_16 AC 180 ms
70,120 KB
testcase_17 AC 181 ms
71,916 KB
testcase_18 AC 176 ms
72,452 KB
testcase_19 AC 179 ms
71,788 KB
testcase_20 AC 181 ms
71,820 KB
testcase_21 AC 179 ms
72,500 KB
testcase_22 AC 181 ms
70,204 KB
testcase_23 AC 179 ms
71,948 KB
testcase_24 AC 179 ms
71,712 KB
testcase_25 AC 179 ms
72,780 KB
testcase_26 AC 181 ms
71,728 KB
testcase_27 AC 175 ms
71,556 KB
testcase_28 AC 178 ms
71,756 KB
testcase_29 AC 182 ms
72,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no246;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int left = 1;
		int right = (int) 1E9 + 1;
		while(left + 1 < right) {
			int c = (left + right) / 2;
			System.out.println("? " + c);
			if (sc.nextInt() == 1) {
				left = c;
			}else{
				right = c;
			}
		}
		System.out.println("! " + left);
	}

}
0