結果

問題 No.1663 Maximum Remainder
ユーザー Masaki Kitaguchi
提出日時 2022-01-07 15:12:50
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 12,077 ms
コンパイル使用メモリ 404,240 KB
実行使用メモリ 13,580 KB
最終ジャッジ日時 2024-11-13 23:19:59
合計ジャッジ時間 13,316 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut buf = String::new();
    let mut input = {
        use std::io::Read;
        std::io::stdin().read_to_string(&mut buf).unwrap();
        buf.split_whitespace()
    };

    let a: usize = input.next().unwrap().parse().unwrap();
    let b: usize = input.next().unwrap().parse().unwrap();
    let c: usize = input.next().unwrap().parse().unwrap();
    let d: usize = input.next().unwrap().parse().unwrap();
    let m: usize = input.next().unwrap().parse().unwrap();

    let output = {
        let mut v = vec![];
        for i in a..=b {
            for j in c..=d {
                v.push((i + j) % m);
            }
        }
        v.sort();
        v.last().unwrap().clone()
    };

    println!("{}", output);
}
0