結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
kenji_shioya
|
| 提出日時 | 2016-06-16 21:37:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 604 bytes |
| 記録 | |
| コンパイル時間 | 3,422 ms |
| コンパイル使用メモリ | 76,028 KB |
| 実行使用メモリ | 74,920 KB |
| 平均クエリ数 | 4.00 |
| 最終ジャッジ日時 | 2024-07-16 10:28:00 |
| 合計ジャッジ時間 | 10,576 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 30 |
ソースコード
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("head " + head);
System.out.println("tail " + tail);
}
System.out.println("! " + (center - 1));
}
}
kenji_shioya