結果

問題 No.582 キャンディー・ボックス3
コンテスト
ユーザー phspls
提出日時 2020-06-20 15:59:38
言語 Rust
(1.93.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 743 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 658 ms
コンパイル使用メモリ 186,240 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-25 01:13:42
合計ジャッジ時間 1,701 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let mut c = String::new();
    std::io::stdin().read_line(&mut c).ok();
    let c: Vec<usize> = c.trim().split_whitespace().map(|s| s.parse().unwrap()).filter(|&s| s > 0).collect();

    let summary: usize = c.iter().map(|i| *i).sum();
    let has2: Vec<usize> = c.iter().map(|i| *i).filter(|&i| i > 1).collect();
    if has2.len() == 0 {
        if summary % 2 == 0 {
            println!("B");
        } else {
            println!("A");
        }
    } else if has2.len() > 1 || has2[0] > 2 {
        println!("B");
    } else {
        if summary % 2 == 0 {
            println!("B");
        } else {
            println!("A");
        }
    }
}
0