結果

問題 No.2259 Gas Station
ユーザー estece1
提出日時 2023-06-10 21:41:36
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 14,028 ms
コンパイル使用メモリ 378,144 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-03 02:36:36
合計ジャッジ時間 22,103 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

macro_rules! scan_iter {
    ($buf:expr) => {{
        use std::io::{stdin, BufRead};
        use std::str::FromStr;

        $buf.clear();
        stdin().lock().read_line(&mut $buf).unwrap();
        $buf.trim()
            .split(" ")
            .map(|x| FromStr::from_str(x).unwrap())
    }};
}

macro_rules! scan_vec {
    ($buf:expr) => {
        scan_iter!($buf).collect::<Vec<_>>()
    };
}

macro_rules! scan_into {
    ($buf:expr) => {
        scan_vec!($buf).try_into().unwrap()
    };
}

fn main() {
    let mut b = String::new();
    let [l, r, c]: [i32; 3] = scan_into!(b);

    println!(
        "{}",
        (l..=r)
            .map(|x| match 1000 - (c * x) % 1000 {
                1000 => 0,
                y => y,
            })
            .min()
            .unwrap()
    );
}
0