結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             viptnet
                         | 
                    
| 提出日時 | 2016-11-06 15:51:05 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 143 ms / 2,000 ms | 
| コード長 | 859 bytes | 
| コンパイル時間 | 3,422 ms | 
| コンパイル使用メモリ | 75,216 KB | 
| 実行使用メモリ | 54,332 KB | 
| 最終ジャッジ日時 | 2024-11-25 03:20:21 | 
| 合計ジャッジ時間 | 8,932 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
package yukicoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
public class No349 {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String,Integer> map = new HashMap<String, Integer>();
    
        for (int i = 0; i < n; i++) {
        	String eto = sc.next();
        	if (map.containsKey(eto)) {
        		map.put(eto, map.get(eto) + 1);
        	} else {
        		map.put(eto, 1);
        	}
        }
        int max = 0;
        for(Entry<String, Integer> e : map.entrySet()) {
            if(max < e.getValue()) {
            	max = e.getValue();
            }
        }
        if ((n+1)/2 >= max) {
        	System.out.println("YES");
        }else {
        	System.out.println("NO");
        }
	}
}
            
            
            
        
            
viptnet