結果

問題 No.236 鴛鴦茶
ユーザー tonyu0
提出日時 2020-04-28 00:03:05
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 736 bytes
コンパイル時間 12,315 ms
コンパイル使用メモリ 379,520 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 16:15:51
合計ジャッジ時間 13,608 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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 mut a: f64 = itr.next().unwrap().parse().unwrap();
    let mut b: f64 = itr.next().unwrap().parse().unwrap();
    let x: f64 = itr.next().unwrap().parse().unwrap();
    let y: f64 = itr.next().unwrap().parse().unwrap();

    if a < b {
        b /= a;
        if x * b <= y {
            println!("{:.10}", x + x * b);
        } else {
            println!("{:.10}", y + y / b);
        }
    } else {
        a /= b;
        if y * a <= x {
            println!("{:.10}", y + y * a);
        } else {
            println!("{:.10}", x + x / a);
        }
    }
}
0