結果

問題 No.112 ややこしい鶴亀算
ユーザー phspls
提出日時 2020-02-23 12:36:05
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 486 bytes
コンパイル時間 20,006 ms
コンパイル使用メモリ 378,356 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-10 01:47:13
合計ジャッジ時間 14,788 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    let summary: usize = a.iter().sum::<usize>() / (n-1);
    let turtle: usize = a.iter().filter(|i| summary - **i == 2).count();
    println!("{} {}", turtle, n - turtle);
}
0