use std::io::{self, prelude::*}; use std::str::FromStr; #[derive(Debug)] pub struct Scanner { reader: R, buf: String, pos: usize, } impl Scanner where R: BufRead, { pub fn new(reader: R) -> Scanner { Scanner { reader, buf: String::new(), pos: 0, } } pub fn next(&mut self) -> io::Result> where T: FromStr, { let start = loop { match self.rest().find(|c| c != ' ') { Some(i) => break i, None => self.fill_buf()?, } }; self.pos += start; let len = 1 + self.rest()[1..].find(' ').unwrap_or(self.rest()[1..].len()); let val = self.rest()[..len].parse(); if val.is_ok() { self.pos += len; } Ok(val) } fn rest(&self) -> &str { &self.buf[self.pos..] } fn fill_buf(&mut self) -> io::Result<()> { self.buf.clear(); self.pos = 0; let read = self.reader.read_line(&mut self.buf)?; if read == 0 { return Err(io::ErrorKind::UnexpectedEof.into()); } if *self.buf.as_bytes().last().unwrap() == b'\n' { self.buf.pop(); } Ok(()) } } fn main() -> io::Result<()> { let stdin = io::stdin(); let reader = stdin.lock(); let mut scanner = Scanner::new(reader); macro_rules! scan { ($T:ty) => { scanner.next::<$T>()?.unwrap() }; } let stdout = io::stdout(); let mut writer = io::BufWriter::new(stdout.lock()); macro_rules! println { ($fmt:expr, $($arg:tt)*) => { writeln!(writer, $fmt, $($arg)*)? }; } let m = scan!(usize); for _ in 0..m { let a = scan!(u64) as f64; let b = scan!(u64) as f64; let t = scan!(f64); let ans = if a == 0. { t.powf(1. / b).exp() } else if b == 0. { t.powf(1. / a) } else { let mut n: f64 = 2.; while { let t1 = n.ln(); let t2 = n.powf(a - 2.); let t3 = t1.powf(b - 2.); let d0 = t2 * n * n * t3 * t1 * t1 - t; let d1 = t2 * n * t3 * t1 * (a * t1 + b); let d2 = t2 * t3 * (((a * 2. - 1.) * b + (a - 1.) * a * t1) * t1 + (b - 1.) * b); let d = d0 / (d1 - (d0 * d2) / (d1 * 2.)); n -= d; d.abs() > 10e-10 } {} n }; println!("{:.9}", ans); } Ok(()) }