結果

問題 No.182 新規性の虜
ユーザー kohaku_kohaku
提出日時 2016-11-13 05:17:11
言語 Java
(openjdk 23)
結果
AC  
実行時間 657 ms / 5,000 ms
コード長 542 bytes
コンパイル時間 2,208 ms
コンパイル使用メモリ 74,792 KB
実行使用メモリ 48,516 KB
最終ジャッジ日時 2024-12-27 11:01:04
合計ジャッジ時間 13,859 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] A = new int [N+2];
        A[0] = 0;
        A[N+1] = Integer.MAX_VALUE;
        for(int i=1; i<=N; i++){
            A[i] = sc.nextInt();
        }
        Arrays.sort(A);
        int count = 0;
        for(int i=1; i<=N; i++){
            if(A[i]!=A[i-1] && A[i]!=A[i+1]){
                count++;
            }
        }
        System.out.println(count);
    }
}
0