結果

問題 No.149 碁石の移動
ユーザー tonyu0
提出日時 2020-04-04 13:00:48
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 11,034 ms
コンパイル使用メモリ 401,104 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 07:14:23
合計ジャッジ時間 12,045 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `bb`
  --> src/main.rs:10:9
   |
10 |     let bb: i32 = itr.next().unwrap().parse().unwrap();
   |         ^^ help: if this is intentional, prefix it with an underscore: `_bb`
   |
   = note: `#[warn(unused_variables)]` on by default

ソースコード

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 aw: i32 = itr.next().unwrap().parse().unwrap();
    let ab: i32 = itr.next().unwrap().parse().unwrap();
    let mut bw: i32 = itr.next().unwrap().parse().unwrap();
    let bb: i32 = itr.next().unwrap().parse().unwrap();
    let c: i32 = itr.next().unwrap().parse().unwrap();
    let d: i32 = itr.next().unwrap().parse().unwrap();

    if c > ab {
        aw -= c - ab;
        bw += c - ab;
    }
    aw += std::cmp::min(d, bw);

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