結果

問題 No.1793 実数当てゲーム
ユーザー akakimidoriakakimidori
提出日時 2021-12-22 04:41:38
言語 Rust
(1.77.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 2,925 ms
コンパイル使用メモリ 138,328 KB
実行使用メモリ 24,204 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-10-13 22:02:41
合計ジャッジ時間 6,789 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,664 KB
testcase_01 AC 26 ms
24,204 KB
testcase_02 AC 91 ms
23,556 KB
testcase_03 AC 94 ms
23,904 KB
testcase_04 AC 95 ms
23,436 KB
testcase_05 AC 93 ms
23,400 KB
testcase_06 AC 93 ms
23,436 KB
testcase_07 AC 91 ms
23,520 KB
testcase_08 AC 93 ms
23,940 KB
testcase_09 AC 94 ms
23,628 KB
testcase_10 AC 93 ms
23,856 KB
testcase_11 AC 91 ms
23,544 KB
testcase_12 AC 92 ms
23,844 KB
testcase_13 AC 92 ms
23,268 KB
testcase_14 AC 94 ms
23,316 KB
testcase_15 AC 93 ms
23,856 KB
testcase_16 AC 94 ms
23,916 KB
testcase_17 AC 94 ms
23,436 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 = 0.0000099999;
    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!(),
        }
    }
    println!("! {}", (l * r).sqrt());
}

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