結果

問題 No.253 ロウソクの長さ
ユーザー ぴろずぴろず
提出日時 2015-07-24 23:00:02
言語 Java
(openjdk 23)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 76,940 KB
実行使用メモリ 70,960 KB
平均クエリ数 21.94
最終ジャッジ日時 2024-07-16 20:49:28
合計ジャッジ時間 9,900 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

package no253;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = 10;
		int r = 1000000001;
		int t = 0;
		while(l + 1 < r) {
			int c = t == 0 ? 200 : (l + r) / 2;
//			System.out.println(t + "," + l + "," + r + "," + c);
			System.out.println("? " + (c - t));
			int x = sc.nextInt();
			if (x == 0) {
				l = c;
				break;
			}else if(x < 0) {
				r = c;
			}else{
				l = c;
			}
			t++;
		}
		System.out.println("! " + l);
	}

}
0