結果
| 問題 |
No.1187 皇帝ペンギン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 13:47:42 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 175 ms / 1,000 ms |
| コード長 | 1,052 bytes |
| コンパイル時間 | 3,786 ms |
| コンパイル使用メモリ | 80,180 KB |
| 実行使用メモリ | 70,976 KB |
| 平均クエリ数 | 20.96 |
| 最終ジャッジ日時 | 2024-07-17 06:13:19 |
| 合計ジャッジ時間 | 15,872 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 54 |
ソースコード
package gioku2020day1;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class F2 {
static Scanner in;
static PrintWriter out;
static String INPUT = "";
static boolean get(int x)
{
out.println("? " + x);
out.flush();
return in.next().equals("safe");
}
static void solve()
{
int low = 0, high = 1000;
while(high - low > 1){
int h = high+low>>1;
boolean r1 = get(h);
boolean r2 = get(h+1);
if(!r1 && !r2){
high = h;
}else{
low = h;
}
}
out.println("! " + (high-1));
out.flush();
}
public static void main(String[] args) throws Exception
{
in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
out = new PrintWriter(System.out);
solve();
out.flush();
}
static int ni() { return Integer.parseInt(in.next()); }
static long nl() { return Long.parseLong(in.next()); }
static double nd() { return Double.parseDouble(in.next()); }
static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}