結果

問題 No.246 質問と回答
ユーザー byakko0514byakko0514
提出日時 2015-08-01 15:56:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 364 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 74,120 KB
実行使用メモリ 72,624 KB
平均クエリ数 30.87
最終ジャッジ日時 2023-09-23 20:05:53
合計ジャッジ時間 9,532 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 192 ms
72,520 KB
testcase_01 AC 186 ms
71,996 KB
testcase_02 AC 185 ms
72,316 KB
testcase_03 AC 182 ms
71,980 KB
testcase_04 AC 185 ms
72,220 KB
testcase_05 AC 185 ms
72,296 KB
testcase_06 AC 187 ms
72,084 KB
testcase_07 AC 184 ms
72,516 KB
testcase_08 AC 186 ms
72,236 KB
testcase_09 AC 187 ms
72,144 KB
testcase_10 AC 186 ms
72,212 KB
testcase_11 AC 185 ms
71,788 KB
testcase_12 AC 181 ms
69,696 KB
testcase_13 AC 179 ms
72,624 KB
testcase_14 AC 185 ms
71,892 KB
testcase_15 AC 182 ms
72,288 KB
testcase_16 AC 183 ms
72,268 KB
testcase_17 AC 181 ms
71,828 KB
testcase_18 AC 179 ms
72,532 KB
testcase_19 AC 183 ms
71,784 KB
testcase_20 AC 185 ms
72,184 KB
testcase_21 AC 184 ms
72,600 KB
testcase_22 AC 184 ms
72,480 KB
testcase_23 AC 191 ms
71,776 KB
testcase_24 AC 186 ms
71,808 KB
testcase_25 AC 188 ms
72,428 KB
testcase_26 AC 190 ms
72,040 KB
testcase_27 AC 190 ms
72,304 KB
testcase_28 AC 191 ms
71,904 KB
testcase_29 AC 189 ms
71,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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