結果

問題 No.182 新規性の虜
ユーザー crazybbb3crazybbb3
提出日時 2017-02-04 13:00:32
言語 Java19
(openjdk 21)
結果
AC  
実行時間 299 ms / 5,000 ms
コード長 1,877 bytes
コンパイル時間 5,409 ms
コンパイル使用メモリ 88,208 KB
実行使用メモリ 61,868 KB
最終ジャッジ日時 2023-08-27 14:22:13
合計ジャッジ時間 8,791 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
51,136 KB
testcase_01 AC 57 ms
50,696 KB
testcase_02 AC 57 ms
50,584 KB
testcase_03 AC 56 ms
50,636 KB
testcase_04 AC 57 ms
50,860 KB
testcase_05 AC 57 ms
48,932 KB
testcase_06 AC 57 ms
51,024 KB
testcase_07 AC 56 ms
50,632 KB
testcase_08 AC 248 ms
59,644 KB
testcase_09 AC 299 ms
61,716 KB
testcase_10 AC 280 ms
61,804 KB
testcase_11 AC 259 ms
59,656 KB
testcase_12 AC 201 ms
57,072 KB
testcase_13 AC 57 ms
50,768 KB
testcase_14 AC 57 ms
50,784 KB
testcase_15 AC 57 ms
50,452 KB
testcase_16 AC 57 ms
50,800 KB
testcase_17 AC 56 ms
50,776 KB
testcase_18 AC 220 ms
57,388 KB
testcase_19 AC 193 ms
57,032 KB
testcase_20 AC 176 ms
56,768 KB
testcase_21 AC 235 ms
57,452 KB
testcase_22 AC 193 ms
57,172 KB
testcase_23 AC 59 ms
50,680 KB
testcase_24 AC 254 ms
61,868 KB
testcase_25 AC 202 ms
57,632 KB
testcase_26 AC 137 ms
55,628 KB
testcase_27 AC 58 ms
50,744 KB
evil01.txt AC 291 ms
61,632 KB
evil02.txt AC 290 ms
62,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int a = ni();
            map.merge(a, 1, (x, y) -> x + y);
        }
        out.println(map.values().stream().filter(cnt -> cnt == 1).count());
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0