結果

問題 No.804 野菜が苦手
ユーザー hitoyozakehitoyozake
提出日時 2019-03-29 22:59:23
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 158,976 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 16:47:54
合計ジャッジ時間 1,116 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 1 ms
5,376 KB
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `r`
 --> main.rs:4:9
  |
4 |     let r = std::io::stdin().read_line(&mut x);
  |         ^ help: if this is intentional, prefix it with an underscore: `_r`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn get_line()->String{
    let mut x  = String::new();
    let r = std::io::stdin().read_line(&mut x);

    x
}


fn main() {

    let nlines = String::from(get_line().trim());

    let nums: Vec<&str> = nlines.split(' ').collect();

    
    let y: u32 = nums[0].parse::<u32>().unwrap(); 
    let niku: u32 = nums[1].parse::<u32>().unwrap();
    let times: u32 = nums[2].parse::<u32>().unwrap();
    let maxsum:u32 = nums[3].parse::<u32>().unwrap();

    let answer = std::cmp::min(niku/times, y); //肉
    let ans2 = std::cmp::min(maxsum/((1+times)*answer), answer); // 合計数の最小
    let ans3 = std::cmp::min(ans2, y); // 野菜


    println!("{}", ans3);
}
0