#[macro_export] macro_rules! setup { { mut $input:ident: SplitWhitespace $(,)? } => { use std::io::Read; let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut $input = buf.split_whitespace(); }; } #[macro_export] macro_rules! parse_next { ($str_iter:expr) => { $str_iter.next().unwrap().parse().unwrap() }; } fn main() { setup! { mut input: SplitWhitespace }; // ax + by = c // dx + ey = f let a: f64 = parse_next!(input); let b: f64 = parse_next!(input); let c: f64 = parse_next!(input); let d: f64 = parse_next!(input); let e: f64 = parse_next!(input); let f: f64 = parse_next!(input); // aex + bey = ce // bdx + bey = bf let x = (c * e - b * f) / (a * e - b * d); // adx + bdy = cd // adx + aey = af let y = (c * d - a * f) / (b * d - a * e); let ans = { let x = (x * 1e4).trunc() / 1e4; let y = (y * 1e4).trunc() / 1e4; format!("{} {}", x, y) }; println!("{}", ans); }