結果

問題 No.920 あかあお
コンテスト
ユーザー phspls
提出日時 2020-01-05 20:28:55
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 824µs
コード長 586 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 465 ms
コンパイル使用メモリ 190,872 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-09-28 09:25:24
合計ジャッジ時間 1,995 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::io::Read;

fn solve(balls: Vec<i8>) {
    let large = std::cmp::max(balls[0], balls[1]);
    let small = std::cmp::min(balls[0], balls[1]);
    let white = balls[2];
    let yukari = small + std::cmp::min(large - small, white) + std::cmp::max(0, white - large + small) / 2;
    println!("{}", yukari);
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let balls: Vec<i8> = s.trim().split('\n').next().unwrap().trim()
        .split_whitespace()
        .map(|s| s.parse::<i8>().unwrap())
        .collect();
    solve(balls);
}
0