結果

問題 No.182 新規性の虜
ユーザー rf141
提出日時 2015-08-09 22:13:47
言語 Java
(openjdk 23)
結果
AC  
実行時間 681 ms / 5,000 ms
コード長 618 bytes
コンパイル時間 3,660 ms
コンパイル使用メモリ 84,396 KB
実行使用メモリ 53,876 KB
最終ジャッジ日時 2024-12-26 19:36:32
合計ジャッジ時間 15,444 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Novelty{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		System.out.println(counter(n,scan));
	}
	public static int counter(int n, Scanner scan){
		HashMap<Integer,Integer> hash = new HashMap<Integer,Integer>();
		for(int i = 0; i < n; i++){
			int now = scan.nextInt();
			if(!hash.containsKey(now)){
				hash.put(now,1);
				continue;
			}
			if(hash.containsKey(now)){
				hash.put(now,hash.get(now)+1);
			}
		}
		int count=0;
		for(int key : hash.values()){
			if(key!=1)continue;
			count++;
		}
		return count;
	}
}
0