結果
問題 |
No.246 質問と回答
|
ユーザー |
![]() |
提出日時 | 2016-06-16 21:37:54 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 520 bytes |
コンパイル時間 | 3,041 ms |
コンパイル使用メモリ | 76,092 KB |
実行使用メモリ | 73,032 KB |
平均クエリ数 | 30.30 |
最終ジャッジ日時 | 2024-07-16 10:28:36 |
合計ジャッジ時間 | 10,376 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 15 |
ソースコード
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 - 1; }else{ head = center; } } System.out.println("! " + (center - 1)); } }