結果

問題 No.182 新規性の虜
コンテスト
ユーザー yuki2006
提出日時 2015-06-24 17:12:33
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
WA  
実行時間 -
コード長 762 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,626 ms
コンパイル使用メモリ 83,232 KB
実行使用メモリ 59,128 KB
最終ジャッジ日時 2026-03-29 08:29:24
合計ジャッジ時間 9,237 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static int solve(int[] A){
        int count = 0;
        HashSet<Integer> cheack = new HashSet<Integer>();
        
        for(int now : A){
            if (!cheack.contains(now)) {
                cheack.add(now);
                count++;
            }
            else {
                 count--;
            }
        }
        
        if(count > 0) return count; else return 0;
    }
    
    public static void main(String[] args){
        Scanner S = new Scanner(System.in);
        int N = S.nextInt();
        int A[] = new int[N];

        for (int i = 0; i < N; i++) {
            A[i] = S.nextInt();
        }
        
        System.out.println(solve(A));
    }
}
0