結果
| 問題 | 
                            No.246 質問と回答
                             | 
                    
| コンテスト | |
| ユーザー | 
                             shimashimau67
                         | 
                    
| 提出日時 | 2015-08-01 14:10:46 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 220 ms / 2,000 ms | 
| コード長 | 906 bytes | 
| コンパイル時間 | 2,511 ms | 
| コンパイル使用メモリ | 76,156 KB | 
| 実行使用メモリ | 70,992 KB | 
| 平均クエリ数 | 44.30 | 
| 最終ジャッジ日時 | 2024-07-16 19:53:00 | 
| 合計ジャッジ時間 | 10,349 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 30 | 
ソースコード
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;
                    }
                }
            }
        }
	}
}
            
            
            
        
            
shimashimau67