結果

問題 No.419 直角三角形
ユーザー cra77756176
提出日時 2022-12-13 20:27:34
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 461 bytes
コンパイル時間 14,238 ms
コンパイル使用メモリ 379,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 14:36:17
合計ジャッジ時間 14,636 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut xx = String::new();
    std::io::stdin().read_line(&mut xx).ok();
    let xx: Vec<&str> = xx.split_whitespace().collect();
    let ff: Vec<f64> = xx.clone().into_iter().flat_map(str::parse).collect();

    if xx[0] == xx[1] {
        println!("{}", ff[0].hypot(ff[0]));
    } else {
        let longer = ff[0].max(ff[1]);
        let shorter = ff[0].min(ff[1]);
        println!("{}", (longer.powi(2) - shorter.powi(2)).sqrt());
    }
}
0