結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-05-04 12:58:10 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 977 bytes | 
| コンパイル時間 | 2,486 ms | 
| コンパイル使用メモリ | 79,164 KB | 
| 実行使用メモリ | 56,112 KB | 
| 最終ジャッジ日時 | 2024-10-05 06:23:08 | 
| 合計ジャッジ時間 | 7,636 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 WA * 4 | 
ソースコード
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
enum Eto {
	ne, ushi, tora, u, tatsu, mi, uma, hitsuji, saru, tori, inu, i;
}
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] input = new String[51];
		if (args.length == 0) {
			int i = 0;
			while (sc.hasNext()) {
				input[i] = sc.nextLine();
				i++;
			}
		} else {
			input = args;
		}
		System.out.println(solve(input));
		sc.close();
	}
	public static String solve(String[] in) {
		boolean ans = true;
		Map<Eto, Integer> d = new HashMap<>();
		for (Eto e : Eto.values()) {
			d.put(e, 0);
		}
		int total = 0;
		for (int i = 1; i < in.length; i++) {
			if(in[i] == null || in[i].isEmpty()){
				continue;
			}
			Eto e = Eto.valueOf(in[i]);
			d.put(e, d.get(e) + 1);
			total++;
		}
		for (Eto e : Eto.values()) {
			if (total - d.get(e) < d.get(e) / 2 + 1) {
				ans = false;
			}
		}
		return ans ? "YES" : "NO";
	}
}