結果

問題 No.955 ax^2+bx+c=0
ユーザー phsplsphspls
提出日時 2020-01-11 19:57:02
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 13,288 ms
コンパイル使用メモリ 380,100 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 09:20:53
合計ジャッジ時間 16,609 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 80
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn solve(abc: Vec<f64>) {
    let a = abc[0];
    let b = abc[1];
    let c = abc[2];
    let temp = b * b - 4f64 * a * c;
    if temp > 0.0 {
        println!("{}", 2);
        println!("{}", (-b - temp.powf(0.5)) / (2.0f64 * a));
        println!("{}", (-b + temp.powf(0.5)) / (2.0f64 * a));
    } else if temp == 0.0 {
        println!("{}", 1);
        println!("{}", -b / (2.0f64 * a));
    } else {
        println!("{}", 0);
    }
}

fn main() {
    let mut abc = String::new();
    std::io::stdin().read_to_string(&mut abc).ok();
    let abc: Vec<f64> = abc.trim().split('\n').next().unwrap().trim().split_whitespace().map(|i| i.parse::<f64>().unwrap()).collect();
    solve(abc);
}
0