結果

問題 No.182 新規性の虜
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-17 21:26:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 651 ms / 5,000 ms
コード長 598 bytes
コンパイル時間 1,981 ms
コンパイル使用メモリ 74,224 KB
実行使用メモリ 66,908 KB
最終ジャッジ日時 2023-08-27 16:44:06
合計ジャッジ時間 12,748 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,664 KB
testcase_01 AC 122 ms
55,476 KB
testcase_02 AC 119 ms
55,908 KB
testcase_03 AC 121 ms
55,496 KB
testcase_04 AC 122 ms
55,900 KB
testcase_05 AC 124 ms
55,576 KB
testcase_06 AC 121 ms
55,732 KB
testcase_07 AC 125 ms
55,660 KB
testcase_08 AC 514 ms
63,304 KB
testcase_09 AC 651 ms
64,916 KB
testcase_10 AC 610 ms
65,220 KB
testcase_11 AC 573 ms
62,764 KB
testcase_12 AC 414 ms
60,916 KB
testcase_13 AC 122 ms
55,948 KB
testcase_14 AC 126 ms
56,004 KB
testcase_15 AC 120 ms
55,708 KB
testcase_16 AC 123 ms
55,432 KB
testcase_17 AC 127 ms
56,028 KB
testcase_18 AC 501 ms
60,704 KB
testcase_19 AC 434 ms
60,404 KB
testcase_20 AC 392 ms
60,184 KB
testcase_21 AC 499 ms
60,592 KB
testcase_22 AC 386 ms
60,392 KB
testcase_23 AC 117 ms
55,672 KB
testcase_24 AC 564 ms
66,908 KB
testcase_25 AC 480 ms
60,580 KB
testcase_26 AC 281 ms
60,688 KB
testcase_27 AC 122 ms
56,664 KB
evil01.txt AC 636 ms
70,344 KB
evil02.txt AC 663 ms
70,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
 	}
}

0