結果

問題 No.182 新規性の虜
ユーザー chiho_miyako
提出日時 2015-04-16 23:27:16
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 616 bytes
コンパイル時間 2,107 ms
コンパイル使用メモリ 74,448 KB
実行使用メモリ 59,852 KB
最終ジャッジ日時 2024-07-04 15:07:33
合計ジャッジ時間 13,614 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int n = koko.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++){
            a[i]=koko.nextInt();
        }
        Arrays.sort(a);
        int count=0;
        if(a[0]!=a[1]){
            count=1;
        }
        for(int i=1; i<n-1; i++){
            if(a[i]!=a[i-1]&&a[i]!=a[i+1]){
                count++;
            }
        }
        if(a[n-1]!=a[n-2]){
            count++;
        }
        System.out.println(count);
    }
}
0