結果

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

ソースコード

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);

    let mut min = 2000;

    for x in l..=r {
        let mut b = 1000 - ((c * x) % 1000);
        if b == 1000 {
            b = 0;
        }

        if b < min {
            min = b;
        }
    }

    println!("{min}");
}
0