結果

問題 No.182 新規性の虜
ユーザー takeya_okino
提出日時 2017-06-25 14:05:55
言語 Java
(openjdk 23)
結果
AC  
実行時間 851 ms / 5,000 ms
コード長 526 bytes
コンパイル時間 5,015 ms
コンパイル使用メモリ 74,744 KB
実行使用メモリ 54,704 KB
最終ジャッジ日時 2024-12-27 16:07:13
合計ジャッジ時間 14,849 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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 ans = 0;
    for(int key : map.keySet()) {
      if(map.get(key) == 1) ans++;
    }
    System.out.println(ans);
  }
}
0