結果

問題 No.349 干支の置き物
ユーザー fal_rndfal_rnd
提出日時 2016-10-28 16:56:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 768 bytes
コンパイル時間 2,481 ms
コンパイル使用メモリ 82,988 KB
実行使用メモリ 41,944 KB
最終ジャッジ日時 2024-05-03 07:16:42
合計ジャッジ時間 8,318 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,300 KB
testcase_01 AC 149 ms
41,204 KB
testcase_02 AC 135 ms
41,496 KB
testcase_03 AC 138 ms
41,444 KB
testcase_04 AC 152 ms
41,924 KB
testcase_05 AC 156 ms
41,584 KB
testcase_06 AC 150 ms
41,472 KB
testcase_07 AC 144 ms
41,468 KB
testcase_08 AC 147 ms
41,944 KB
testcase_09 AC 141 ms
40,804 KB
testcase_10 AC 146 ms
41,688 KB
testcase_11 AC 152 ms
41,824 KB
testcase_12 AC 148 ms
41,484 KB
testcase_13 AC 153 ms
41,756 KB
testcase_14 AC 147 ms
41,796 KB
testcase_15 AC 146 ms
41,472 KB
testcase_16 AC 152 ms
41,544 KB
testcase_17 AC 142 ms
41,488 KB
testcase_18 AC 134 ms
41,592 KB
testcase_19 AC 137 ms
41,376 KB
testcase_20 AC 136 ms
41,656 KB
testcase_21 AC 138 ms
41,464 KB
testcase_22 AC 137 ms
41,572 KB
testcase_23 AC 139 ms
41,488 KB
testcase_24 AC 139 ms
41,468 KB
testcase_25 AC 142 ms
41,456 KB
testcase_26 AC 150 ms
41,776 KB
testcase_27 AC 154 ms
41,776 KB
testcase_28 AC 150 ms
41,936 KB
testcase_29 AC 162 ms
41,716 KB
testcase_30 AC 150 ms
41,536 KB
testcase_31 AC 165 ms
41,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class A {
	static Scanner s = new Scanner(System.in);
	static enum ETO{
		ne,
		ushi,
		tora,
		u,
		tatsu,
		mi,
		uma,
		hitsuji,
		saru,
		tori,
		inu,
		i,
		;

		int amount=0;

		static ETO match(String s) {
			boolean b = false;
			for(ETO eto:ETO.values()) {
				if(s.matches(eto.name())) {
					eto.amount++;
					return eto;
				}
			}
			return null;
		}
		@Override
		public String toString() {
			return this.name()+":"+this.amount;
		}
	}
	public static void main(String[] args) {
		int in = s.nextInt();
		while(s.hasNext()) {
			ETO.match(s.next());
		}
		int max = 0;
		for(ETO e:ETO.values()) {
			max = Math.max(max, e.amount);
		}
		if(max>in-max+1) {
			System.out.println("NO");
		}else {
			System.out.println("YES");
		}
	}
}
0