結果

問題 No.1064 ∪∩∩ / Cup Cap Cap
ユーザー tonyu0
提出日時 2020-05-29 21:54:58
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 825 bytes
コンパイル時間 14,529 ms
コンパイル使用メモリ 402,168 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 04:09:47
合計ジャッジ時間 14,244 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: f64 = itr.next().unwrap().parse().unwrap();
    let b: f64 = itr.next().unwrap().parse().unwrap();
    let c: f64 = itr.next().unwrap().parse().unwrap();
    let d: f64 = itr.next().unwrap().parse().unwrap();

    let e = (a - c) * (a - c) - 8.0 * (b - d);
    if e < 0.0 {
        println!("No");
    } else if e == 0.0 {
        println!("Yes");
    } else {
        let x1 = (c - a - e.sqrt()) / 4.0;
        let x2 = (c - a + e.sqrt()) / 4.0;
        let y1 = x1 * x1 + a * x1 + b;
        let y2 = -1.0 * x2 * x2 + c * x2 + d;
        let p = (y2 - y1) / (x2 - x1);
        let q = y2 - x2 * p;
        println!("{:.10} {:.10}", p, q);
    }
}
0