結果

問題 No.208 王将
ユーザー tonyu0
提出日時 2020-04-09 23:23:15
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 21,706 ms
コンパイル使用メモリ 398,976 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 01:15:16
合計ジャッジ時間 17,846 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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 x: i64 = itr.next().unwrap().parse().unwrap();
    let y: i64 = itr.next().unwrap().parse().unwrap();
    let x2: i64 = itr.next().unwrap().parse().unwrap();
    let y2: i64 = itr.next().unwrap().parse().unwrap();

    let mut ans = 0;

    if x2 < x && y2 < y && x2 == y2 {
        ans = x2 + 2;
        let dx = x - (x2 + 1);
        let dy = y - (y2 + 1);
        ans += std::cmp::max(dx, dy);
    } else {
        ans += std::cmp::max(x, y);
    }
    println!("{}", ans);
}
0