結果
問題 | No.182 新規性の虜 |
ユーザー |
![]() |
提出日時 | 2017-10-17 21:26:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 780 ms / 5,000 ms |
コード長 | 598 bytes |
コンパイル時間 | 2,440 ms |
コンパイル使用メモリ | 76,020 KB |
実行使用メモリ | 54,036 KB |
最終ジャッジ日時 | 2024-12-27 19:47:48 |
合計ジャッジ時間 | 15,054 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i = 0 ; i < n ; i++) { a[i] = sc.nextInt(); } Map<Integer, Integer> map = new HashMap<>(); for(int i = 0 ; i < n ; i++) { map.put(a[i], 0); } for(int i = 0 ; i < n ; i++) { map.put(a[i], map.get(a[i]) + 1); } int ans = 0; for(int i = 0 ; i < n ; i++) { if(map.get(a[i]) == 1) { ans++; } } System.out.println(ans); } }