結果

問題 No.1793 実数当てゲーム
ユーザー akakimidoriakakimidori
提出日時 2021-12-22 04:28:16
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 760 bytes
コンパイル時間 3,630 ms
コンパイル使用メモリ 136,208 KB
実行使用メモリ 24,480 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-10-13 21:18:33
合計ジャッジ時間 6,899 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
24,048 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 94 ms
23,592 KB
testcase_06 AC 94 ms
24,048 KB
testcase_07 AC 91 ms
23,748 KB
testcase_08 AC 93 ms
23,952 KB
testcase_09 AC 94 ms
24,324 KB
testcase_10 AC 93 ms
23,976 KB
testcase_11 AC 92 ms
24,312 KB
testcase_12 AC 92 ms
23,580 KB
testcase_13 AC 95 ms
23,580 KB
testcase_14 AC 96 ms
23,340 KB
testcase_15 AC 93 ms
24,348 KB
testcase_16 AC 94 ms
24,036 KB
testcase_17 AC 93 ms
23,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn read() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    String::from(s.trim())
}

fn run() {
    let mut l = 10f64.powi(-5);
    let mut r = 12.22f64 * 10f64.powi(74);
    for _ in 0..24 {
        let m = (l * r).sqrt();
        println!("? {}", m);
        let ans = read();
        match ans.as_str() {
            "Yes" => l = m,
            "No" => r = m,
            _ => unreachable!(),
        }
    }
    let m = (l * r).sqrt();
    let abs = (m - l).abs().max((r - m).abs()) <= 1e-5;
    let re = r - m <= 1e-5 * r && m - l <= 1e-5 * l;
    assert!(abs || re);
    println!("! {}", (l * r).sqrt());
}

fn main() {
    let t = read().parse::<u32>().unwrap();
    for _ in 0..t {
        run();
    }
}
0