結果

問題 No.182 新規性の虜
ユーザー k_kadorak_kadora
提出日時 2015-06-11 00:17:41
言語 Java19
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 485 bytes
コンパイル時間 3,392 ms
コンパイル使用メモリ 73,296 KB
実行使用メモリ 60,924 KB
最終ジャッジ日時 2023-09-17 05:26:52
合計ジャッジ時間 14,210 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,832 KB
testcase_01 AC 125 ms
55,800 KB
testcase_02 AC 125 ms
55,964 KB
testcase_03 AC 127 ms
55,812 KB
testcase_04 AC 128 ms
56,232 KB
testcase_05 AC 130 ms
55,884 KB
testcase_06 AC 129 ms
55,868 KB
testcase_07 AC 130 ms
55,696 KB
testcase_08 AC 493 ms
60,624 KB
testcase_09 AC 624 ms
60,592 KB
testcase_10 AC 562 ms
60,448 KB
testcase_11 AC 543 ms
60,440 KB
testcase_12 AC 395 ms
60,924 KB
testcase_13 AC 127 ms
55,720 KB
testcase_14 AC 131 ms
55,924 KB
testcase_15 AC 127 ms
55,728 KB
testcase_16 AC 131 ms
55,860 KB
testcase_17 AC 133 ms
55,640 KB
testcase_18 AC 520 ms
60,640 KB
testcase_19 AC 428 ms
60,400 KB
testcase_20 AC 368 ms
60,376 KB
testcase_21 AC 534 ms
60,420 KB
testcase_22 AC 397 ms
60,416 KB
testcase_23 AC 126 ms
55,772 KB
testcase_24 AC 527 ms
60,488 KB
testcase_25 AC 466 ms
60,548 KB
testcase_26 AC 288 ms
60,188 KB
testcase_27 WA -
evil01.txt AC 581 ms
61,076 KB
evil02.txt AC 574 ms
60,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class New {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n,count=0;
		n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i< n;i++){
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		if(n>1){
			if(a[0] != a[1])count++;
			for(int i = 0;i<n-2;i++){
				if(a[i] != a[i+1] && a[i+1] != a[i+2])count++;
			}
			if(n>3){
				if(a[n-2] != a[n-1])count++;
			}
		}else{
			count++;
		}
		System.out.println(count);
	}
}
0