結果

問題 No.349 干支の置き物
ユーザー hnt
提出日時 2016-03-27 21:31:26
言語 Java
(openjdk 23)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 4,152 ms
コンパイル使用メモリ 77,368 KB
実行使用メモリ 41,496 KB
最終ジャッジ日時 2024-11-17 07:29:26
合計ジャッジ時間 8,901 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class no349 {
	public static void main(String[] args){
		int[] eto = new int[12];
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max=0;
		for(int j=0;j<N;j++){
			String A = sc.next();
			switch(A){
			case "ne":eto[0]++;break;
			case "ushi":eto[1]++;break;
			case "tora":eto[2]++;break;
			case "u":eto[3]++;break;
			case "tatsu":eto[4]++;break;
			case "mi":eto[5]++;break;
			case "uma":eto[6]++;break;
			case "hitsuji":eto[7]++;break;
			case "saru":eto[8]++;break;
			case "tori":eto[9]++;break;
			case "inu":eto[10]++;break;
			case "i":eto[11]++;break;
			}
		}
		for(int j=0;j<eto.length;j++){
			max=Math.max(max,eto[j]);
		}
		if(N%2==0&&max<=N/2){
			System.out.println("YES");
		}else if(N%2!=0&&max<=N/2+1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}
}
0