結果

問題 No.246 質問と回答
ユーザー kou6839kou6839
提出日時 2015-07-18 01:41:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 3,179 ms
コンパイル使用メモリ 72,568 KB
実行使用メモリ 73,412 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:00:03
合計ジャッジ時間 10,360 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
71,812 KB
testcase_01 AC 163 ms
71,956 KB
testcase_02 AC 162 ms
71,828 KB
testcase_03 AC 164 ms
71,772 KB
testcase_04 AC 168 ms
72,036 KB
testcase_05 AC 165 ms
71,752 KB
testcase_06 AC 164 ms
71,684 KB
testcase_07 AC 162 ms
72,444 KB
testcase_08 AC 162 ms
72,160 KB
testcase_09 AC 163 ms
71,780 KB
testcase_10 AC 167 ms
71,704 KB
testcase_11 AC 169 ms
72,392 KB
testcase_12 AC 164 ms
72,288 KB
testcase_13 AC 168 ms
71,968 KB
testcase_14 AC 166 ms
72,396 KB
testcase_15 AC 167 ms
72,200 KB
testcase_16 AC 166 ms
72,328 KB
testcase_17 AC 163 ms
71,880 KB
testcase_18 AC 163 ms
71,940 KB
testcase_19 AC 160 ms
72,132 KB
testcase_20 AC 170 ms
72,488 KB
testcase_21 AC 165 ms
73,412 KB
testcase_22 AC 166 ms
72,320 KB
testcase_23 AC 166 ms
71,824 KB
testcase_24 AC 173 ms
72,084 KB
testcase_25 AC 176 ms
71,792 KB
testcase_26 AC 170 ms
72,612 KB
testcase_27 AC 172 ms
72,064 KB
testcase_28 AC 170 ms
72,040 KB
testcase_29 AC 172 ms
71,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main {
	static int rec(int num){
		if(num==1) return 1;
		else return rec(num-1)+num;
	}
    public static void main(String[] args){
        // TODO 自動生成されたメソッド・スタブ
    	Scanner sc = new Scanner(System.in);
    	int a = 1;
    	int b = (int) 1e9;
    	while(a<b-1){
    		int c = (a+b)/2;
    		System.out.println("? "+c);
    		int t = sc.nextInt();
    		if(t==1){
    			a=c;
    		}else{
    			b=c;
    		}
    	}
    	System.out.println("! "+a);
    }
}
0