結果

問題 No.2259 Gas Station
ユーザー estece1estece1
提出日時 2023-06-10 21:55:01
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 818 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 147,000 KB
実行使用メモリ 6,412 KB
最終ジャッジ日時 2023-08-31 01:14:41
合計ジャッジ時間 6,742 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,380 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

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