結果

問題 No.182 新規性の虜
ユーザー h_tyokinuhata
提出日時 2016-04-10 17:46:35
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 553 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 73,892 KB
実行使用メモリ 61,864 KB
最終ジャッジ日時 2024-10-04 05:45:48
合計ジャッジ時間 12,628 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 RE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt(), min = Integer.MAX_VALUE, max = Integer.MIN_VALUE, cnt = 0;
		int[] a = new int[N];
		
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			
			min = Math.min(min, a[i]);
			max = Math.max(max, a[i]);
		}
		
		int[] A = new int[max - min + 1];
	
		for(int i = 0; i < N; i++) {
			A[a[i] - 1]++;
		}
		
		for(int i = 0; i < A.length; i++) {
			if(A[i] == 1)	cnt++;
		}
		
		System.out.println(cnt);
	}
}
0