結果

問題 No.246 質問と回答
ユーザー shimashimau67shimashimau67
提出日時 2015-08-01 14:10:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 906 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 73,440 KB
実行使用メモリ 72,740 KB
平均クエリ数 44.30
最終ジャッジ日時 2023-09-23 20:05:01
合計ジャッジ時間 9,962 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 207 ms
71,836 KB
testcase_01 AC 197 ms
71,800 KB
testcase_02 AC 206 ms
72,460 KB
testcase_03 AC 189 ms
71,760 KB
testcase_04 AC 189 ms
72,136 KB
testcase_05 AC 193 ms
72,304 KB
testcase_06 AC 193 ms
71,908 KB
testcase_07 AC 192 ms
71,780 KB
testcase_08 AC 186 ms
71,744 KB
testcase_09 AC 190 ms
71,856 KB
testcase_10 AC 192 ms
71,964 KB
testcase_11 AC 191 ms
71,568 KB
testcase_12 AC 187 ms
72,740 KB
testcase_13 AC 185 ms
71,568 KB
testcase_14 AC 187 ms
70,304 KB
testcase_15 AC 191 ms
72,460 KB
testcase_16 AC 186 ms
72,012 KB
testcase_17 AC 188 ms
72,072 KB
testcase_18 AC 191 ms
70,348 KB
testcase_19 AC 192 ms
72,568 KB
testcase_20 AC 193 ms
72,268 KB
testcase_21 AC 189 ms
71,572 KB
testcase_22 AC 191 ms
72,256 KB
testcase_23 AC 186 ms
72,100 KB
testcase_24 AC 190 ms
72,044 KB
testcase_25 AC 190 ms
72,388 KB
testcase_26 AC 194 ms
69,800 KB
testcase_27 AC 195 ms
71,964 KB
testcase_28 AC 196 ms
72,324 KB
testcase_29 AC 190 ms
71,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		int max = 1000000000;
        int b = max / 2;
        int ask = max / 2;

        Scanner sc = new Scanner(System.in);
        IN : for (int i = 0; i < 100; i++)
        {
            System.out.println("? " + ask);
            b /= 2;
            if (sc.nextInt() == 1)
            {
                ask += b;
            }
            else
            {
                ask -= b;
            }

            if (b == 0)
            {
                ask -= 13;
                while (true)
                {
                    System.out.println("? " + ask);
                    if (sc.nextInt() == 1) ask++;
                    else
                    {
                    	System.out.println("! " + (ask - 1));
                        break IN;
                    }
                }
            }
        }
	}
}
0