結果

問題 No.182 新規性の虜
ユーザー jimano
提出日時 2018-01-15 23:29:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,032 ms / 5,000 ms
コード長 573 bytes
コンパイル時間 6,676 ms
コンパイル使用メモリ 79,496 KB
実行使用メモリ 56,772 KB
最終ジャッジ日時 2024-12-27 20:44:18
合計ジャッジ時間 23,174 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class No0182 {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			Map<Integer, Integer> map = new HashMap<>();
			int size = 0;

			for (int i = 0; i < N; i++) {
				int tmp = sc.nextInt();
				map.computeIfPresent(tmp, (k, v) -> (map.get(tmp) + 1));
				map.putIfAbsent(tmp, 1);
				
			}
			for (int key : map.keySet()) {
				if(map.get(key) == 1) size++;
			}
			System.out.println(size);
		}
	}
}
0