結果
問題 |
No.246 質問と回答
|
ユーザー |
![]() |
提出日時 | 2016-06-16 21:31:00 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 518 bytes |
コンパイル時間 | 3,100 ms |
コンパイル使用メモリ | 76,120 KB |
実行使用メモリ | 72,012 KB |
平均クエリ数 | 29.37 |
最終ジャッジ日時 | 2024-07-16 10:28:23 |
合計ジャッジ時間 | 10,511 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 26 |
ソースコード
import java.util.*; public class Exercise90{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int head = 1; int tail = 1000000000; int center = 0; while(tail - head > 1){ center = (tail - head) / 2 + head; System.out.println("? " + center); System.out.flush(); int answer = sc.nextInt(); if(answer == 0){ tail = center - 2; }else{ head = center + 1; } } System.out.println("! " + center); } }