結果

問題 No.182 新規性の虜
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-16 23:27:16
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 616 bytes
コンパイル時間 2,400 ms
コンパイル使用メモリ 71,704 KB
実行使用メモリ 61,052 KB
最終ジャッジ日時 2023-09-17 21:07:24
合計ジャッジ時間 12,986 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,652 KB
testcase_01 AC 124 ms
55,888 KB
testcase_02 AC 124 ms
55,464 KB
testcase_03 AC 132 ms
55,560 KB
testcase_04 AC 123 ms
55,820 KB
testcase_05 AC 126 ms
55,568 KB
testcase_06 AC 124 ms
56,176 KB
testcase_07 AC 128 ms
55,844 KB
testcase_08 AC 481 ms
61,024 KB
testcase_09 AC 597 ms
60,844 KB
testcase_10 AC 542 ms
60,812 KB
testcase_11 AC 539 ms
60,580 KB
testcase_12 AC 384 ms
60,496 KB
testcase_13 AC 122 ms
55,944 KB
testcase_14 AC 128 ms
56,056 KB
testcase_15 RE -
testcase_16 AC 125 ms
55,956 KB
testcase_17 AC 128 ms
56,272 KB
testcase_18 AC 487 ms
61,052 KB
testcase_19 AC 426 ms
60,040 KB
testcase_20 AC 359 ms
60,288 KB
testcase_21 AC 510 ms
60,380 KB
testcase_22 AC 393 ms
60,620 KB
testcase_23 RE -
testcase_24 AC 507 ms
60,620 KB
testcase_25 AC 477 ms
60,416 KB
testcase_26 AC 293 ms
60,344 KB
testcase_27 AC 120 ms
55,600 KB
evil01.txt AC 559 ms
61,304 KB
evil02.txt AC 558 ms
60,760 KB
権限があれば一括ダウンロードができます

ソースコード

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