結果

問題 No.182 新規性の虜
ユーザー rf141
提出日時 2015-08-09 23:35:40
言語 Java
(openjdk 23)
結果
AC  
実行時間 937 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 5,115 ms
コンパイル使用メモリ 75,876 KB
実行使用メモリ 53,308 KB
最終ジャッジ日時 2024-12-26 19:37:22
合計ジャッジ時間 20,404 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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)){
				if(hash.get(now)>2)continue;
				hash.put(now,hash.get(now)+1);
			}
		}
		int count=0;
		for(int key : hash.values()){
			if(key!=1)continue;
			count++;
		}
		return count;
	}
}
0