結果
| 問題 |
No.456 Millions of Submits!
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-08-09 01:54:17 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,212 bytes |
| コンパイル時間 | 17,291 ms |
| コンパイル使用メモリ | 404,664 KB |
| 実行使用メモリ | 83,136 KB |
| 最終ジャッジ日時 | 2024-11-14 07:07:07 |
| 合計ジャッジ時間 | 21,692 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 6 |
ソースコード
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"));
}
titia