結果

問題 No.182 新規性の虜
ユーザー Tiramister
提出日時 2018-09-02 16:01:07
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 787 bytes
コンパイル時間 15,113 ms
コンパイル使用メモリ 378,620 KB
実行使用メモリ 7,056 KB
最終ジャッジ日時 2024-10-01 19:24:54
合計ジャッジ時間 14,378 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;

#[allow(dead_code)]
fn get_line() -> String {
    let stdin = stdin();
    let mut line = String::new();
    stdin.lock().read_line(&mut line).expect("io error.");
    line.trim().to_string()
}

#[allow(dead_code)]
fn cast<T: FromStr>(s: &str) -> T {
    s.parse().ok().expect("parse error.")
}

#[allow(dead_code)]
fn get_vec<T: FromStr>() -> Vec<T> {
    (&get_line()).split(' ').map(cast::<T>).collect()
}

fn main() {
    get_line();
    let av = get_vec::<u64>();

    let mut cnt = HashMap::<u64, u64>::new();
    for a in av {
        let val = cnt.entry(a).or_insert(0);
        *val += 1;
    }

    let mut ans = 0u64;
    for (_, c) in cnt {
        if c == 1 {ans += 1};
    }
    println!("{}", ans);
}
0