結果

問題 No.182 新規性の虜
ユーザー samplelpmas
提出日時 2016-11-16 02:09:52
言語 Java
(openjdk 23)
結果
AC  
実行時間 759 ms / 5,000 ms
コード長 704 bytes
コンパイル時間 3,000 ms
コンパイル使用メモリ 74,716 KB
実行使用メモリ 54,280 KB
最終ジャッジ日時 2024-12-27 11:06:29
合計ジャッジ時間 16,449 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();

        for (int i = 0; i < n; i++) {

            int a = sc.nextInt();

            if (map.containsKey(a)) {
                map.put(a, (map.get(a) + 1));
            } else {
                map.put(a, 1);
            }

        }

        int count = 0;

        for (int key : map.keySet()) {

            if (map.get(key) == 1) {
                count++;
            }

        }

        System.out.println(count);

    }

}
0