結果

問題 No.208 王将
ユーザー kokatsu
提出日時 2023-04-13 21:42:32
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 877 bytes
コンパイル時間 17,624 ms
コンパイル使用メモリ 382,336 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 17:55:20
合計ジャッジ時間 15,148 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{stdout, Write, BufWriter};

fn main() {
    let input1: Vec<i64> = read_vec();
    let x: i64 = input1[0];
    let y: i64 = input1[1];

    let input2: Vec<i64> = read_vec();
    let x2: i64 = input2[0];
    let y2: i64 = input2[1];

    let mut res: i64 = x.max(y);
    if x > x2 && x == y && x2 == y2 {
        res += 1;
    }

    let mut out = BufWriter::new(stdout().lock());
    writeln!(out, "{}", res).unwrap();
}

#[allow(dead_code)]
fn read_string() -> String {
    let mut s: String = String::new();
    std::io::stdin().read_line(&mut s).ok();

    s.trim().to_string()
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    read_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read_string()
        .split_whitespace()
        .map(|v| v.parse().ok().unwrap())
        .collect()
}
0