結果

問題 No.246 質問と回答
ユーザー nCk_cvnCk_cv
提出日時 2015-07-17 22:30:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 2,346 ms
コンパイル使用メモリ 73,388 KB
実行使用メモリ 72,984 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-07 22:44:54
合計ジャッジ時間 10,006 ms
ジャッジサーバーID
(参考情報)
judge1 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
71,816 KB
testcase_01 AC 198 ms
71,832 KB
testcase_02 AC 196 ms
72,224 KB
testcase_03 AC 200 ms
72,012 KB
testcase_04 AC 197 ms
72,348 KB
testcase_05 AC 197 ms
71,604 KB
testcase_06 AC 194 ms
72,076 KB
testcase_07 AC 198 ms
72,368 KB
testcase_08 AC 195 ms
72,308 KB
testcase_09 AC 194 ms
72,140 KB
testcase_10 AC 201 ms
70,572 KB
testcase_11 AC 190 ms
70,060 KB
testcase_12 AC 195 ms
72,476 KB
testcase_13 AC 198 ms
72,172 KB
testcase_14 AC 197 ms
70,000 KB
testcase_15 AC 195 ms
72,064 KB
testcase_16 AC 196 ms
72,148 KB
testcase_17 AC 197 ms
71,556 KB
testcase_18 AC 196 ms
72,288 KB
testcase_19 AC 197 ms
72,248 KB
testcase_20 AC 196 ms
72,984 KB
testcase_21 AC 198 ms
71,840 KB
testcase_22 AC 201 ms
71,912 KB
testcase_23 AC 196 ms
72,216 KB
testcase_24 AC 196 ms
71,912 KB
testcase_25 AC 195 ms
72,476 KB
testcase_26 AC 202 ms
71,944 KB
testcase_27 AC 198 ms
72,508 KB
testcase_28 AC 200 ms
72,084 KB
testcase_29 AC 196 ms
72,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.awt.*;
import java.awt.geom.*;
import java.io.*;
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int lp = 0;
		int rp = 1000000000;
		while(lp <= rp) {
			System.out.println("? " + (lp + rp)/2);
			boolean ans = (sc.nextInt() == 1)?true:false;
			if(ans) {
				lp = (lp + rp)/2+1;
			}
			else {
				rp = (lp + rp)/2-1;
			}
		}
		System.out.println("! " + rp);
	} 	
}
0