結果

問題 No.920 あかあお
コンテスト
ユーザー elphe
提出日時 2026-01-31 16:38:47
言語 Rust
(1.92.0 + proconio + num + itertools)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 545 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 797 ms
コンパイル使用メモリ 198,884 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-01-31 16:38:49
合計ジャッジ時間 2,080 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
    let mut stdin = stdin.split_ascii_whitespace();

    let x: u8 = stdin.next().unwrap().parse().unwrap();
    let y: u8 = stdin.next().unwrap().parse().unwrap();
    let z: u8 = stdin.next().unwrap().parse().unwrap();

    println!("{}", output(solve(x, y, z)));
}

fn solve(x: u8, y: u8, z: u8) -> u8 {
    if x + z <= y {
        x + z
    } else if y + z <= x {
        y + z
    } else {
        (x + y + z) / 2
    }
}

fn output(ans: u8) -> u8 {
    ans
}
0