結果

問題 No.182 新規性の虜
ユーザー htensaihtensai
提出日時 2020-05-13 10:42:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 625 ms / 5,000 ms
コード長 471 bytes
コンパイル時間 2,293 ms
コンパイル使用メモリ 72,776 KB
実行使用メモリ 65,212 KB
最終ジャッジ日時 2023-10-12 16:52:54
合計ジャッジ時間 14,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,600 KB
testcase_01 AC 126 ms
55,708 KB
testcase_02 AC 124 ms
55,596 KB
testcase_03 AC 126 ms
55,372 KB
testcase_04 AC 125 ms
55,428 KB
testcase_05 AC 133 ms
55,928 KB
testcase_06 AC 122 ms
55,828 KB
testcase_07 AC 127 ms
55,812 KB
testcase_08 AC 496 ms
62,716 KB
testcase_09 AC 625 ms
65,052 KB
testcase_10 AC 585 ms
65,212 KB
testcase_11 AC 553 ms
62,988 KB
testcase_12 AC 395 ms
60,620 KB
testcase_13 AC 121 ms
55,528 KB
testcase_14 AC 126 ms
55,764 KB
testcase_15 AC 122 ms
55,864 KB
testcase_16 AC 124 ms
55,760 KB
testcase_17 AC 126 ms
55,852 KB
testcase_18 AC 522 ms
60,416 KB
testcase_19 AC 449 ms
60,328 KB
testcase_20 AC 371 ms
60,504 KB
testcase_21 AC 516 ms
60,504 KB
testcase_22 AC 394 ms
60,416 KB
testcase_23 AC 123 ms
55,848 KB
testcase_24 AC 554 ms
64,932 KB
testcase_25 AC 449 ms
60,504 KB
testcase_26 AC 282 ms
60,192 KB
testcase_27 AC 125 ms
55,816 KB
evil01.txt AC 628 ms
67,048 KB
evil02.txt AC 647 ms
66,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashSet<Integer> singles = new HashSet<>();
		HashSet<Integer> doubles = new HashSet<>();
		for (int i = 0; i < n; i++) {
		    int x = sc.nextInt();
		    if (singles.contains(x)) {
		        doubles.add(x);
		    } else {
		        singles.add(x);
		    }
		}
		System.out.println(singles.size() - doubles.size());
	}
}
0