結果

問題 No.456 Millions of Submits!
ユーザー titiatitia
提出日時 2023-08-09 01:54:17
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,212 bytes
コンパイル時間 3,807 ms
コンパイル使用メモリ 170,632 KB
実行使用メモリ 83,080 KB
最終ジャッジ日時 2024-04-26 17:31:16
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Failed to read input");
    let q: usize = input.trim().parse().expect("Invalid input");

    let mut ans: Vec<f64> = vec![-1.0; q];

    for tests in 0..q {
        let mut input = String::new();
        io::stdin().read_line(&mut input).expect("Failed to read input");
        let mut numbers = input.split_whitespace().map(|s| s.parse::<f64>().expect("Invalid input"));

        let a: f64 = numbers.next().unwrap();
        let b: f64 = numbers.next().unwrap();
        let t: f64 = numbers.next().unwrap();

        if a == 0.0 {
            ans[tests] = f64::powf(2.718281828, f64::powf(t, 1.0 / b));
            continue;
        }

        let mut max = 10.0;
        let mut min = 0.0;
        let epsilon = 1e-9;

        while max - min > epsilon {
            let mid = (max + min) / 2.0;

            if f64::powf(mid, a) * f64::ln(mid).powf(b) >= t {
                max = mid;
            } else {
                min = mid;
            }
        }

        ans[tests] = (max + min) / 2.0;
    }

    println!("{}", ans.iter().map(|&x| x.to_string()).collect::<Vec<String>>().join("\n"));
}
0