結果
問題 |
No.1175 Simultaneous Equations
|
ユーザー |
|
提出日時 | 2022-01-12 20:14:46 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,071 bytes |
コンパイル時間 | 14,104 ms |
コンパイル使用メモリ | 379,200 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 12:00:11 |
合計ジャッジ時間 | 15,095 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#[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); }