結果

問題 No.379 五円硬貨
ユーザー AyachiGin
提出日時 2016-06-19 21:47:31
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 580 bytes
コンパイル時間 13,018 ms
コンパイル使用メモリ 382,856 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-11 05:24:07
合計ジャッジ時間 13,264 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input)
        .expect("Read error");
    let words: Vec<f64> = input.split_whitespace()
        .map(|w| w.parse().unwrap())
        .collect();

    println!("{}", solve(words[0], words[1], words[2]));
}

fn solve(n: f64, g: f64, v: f64) -> f64 {
    let n = n as u64 / 5;
    let n2 = n as f64;

    g  * n2 / v
}

#[test]
fn it_works() {
    assert_eq!(1000.0, solve(100., 500.0, 10.0));
    assert_eq!(335030261.51740766171,
               solve(187456612., 84877661., 9498174.));
}
0