#[allow(unused_imports)] use std::cmp; use std::fs::File; use std::io::Read; #[allow(dead_code)] fn pow_speedy_with_mod(mut p: i64, mut q: i64, m: i64) -> i64 { p %= m; let mut r = p; let mut ret: i64 = 1; while q > 0 { ret *= if q % 2 == 1 { r } else { 1 }; r *= r; r %= m; q /= 2; ret %= m; } return ret; } fn comb(n: usize, k: usize, m: i64, frac: &[i64], frac_inv: &[i64]) -> i64 { let mut ret = 1i64; if n < k { return 0; } ret *= frac[n] * frac_inv[n - k]; ret %= m; ret *= frac_inv[k]; ret %= m; ret } fn main() { let inputstatus = 1; let mut buf = String::new(); let filename = "inputrust.txt"; if inputstatus == 0 { let mut f = File::open(filename).expect("file not found"); f.read_to_string(&mut buf) .expect("something went wrong reading the file"); } else { std::io::stdin().read_to_string(&mut buf).unwrap(); } let mut iter = buf.split_whitespace(); let a: i32 = iter.next().unwrap().parse().unwrap(); let b: i32 = iter.next().unwrap().parse().unwrap(); let c: i32 = iter.next().unwrap().parse().unwrap(); let af: f64 = a as f64; let bf: f64 = b as f64; let cf: f64 = c as f64; let d = b * b - 4 * a * c; if d < 0 { println!("imaginary"); return; } else if d == 0 { println!("{}", -bf / (2f64 * af)); } else { let df = (bf * bf - 4f64 * af * cf).sqrt(); println!("{} {}", (-bf - df) / (2f64 * af), (-bf + df) / (2f64 * af)); } // let n = iter.next().unwrap().parse().unwrap(); // println!("{}", n); // println!("{:?}", cum_num); }