結果

問題 No.349 干支の置き物
ユーザー tentententen
提出日時 2020-11-04 12:27:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 3,509 ms
コンパイル使用メモリ 72,624 KB
実行使用メモリ 56,392 KB
最終ジャッジ日時 2023-09-29 15:46:23
合計ジャッジ時間 7,832 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,836 KB
testcase_01 AC 118 ms
55,968 KB
testcase_02 AC 117 ms
55,644 KB
testcase_03 AC 125 ms
56,044 KB
testcase_04 AC 131 ms
55,656 KB
testcase_05 AC 129 ms
55,808 KB
testcase_06 AC 131 ms
55,832 KB
testcase_07 AC 127 ms
56,392 KB
testcase_08 AC 130 ms
55,836 KB
testcase_09 AC 125 ms
55,984 KB
testcase_10 AC 121 ms
56,092 KB
testcase_11 AC 123 ms
56,172 KB
testcase_12 AC 123 ms
55,608 KB
testcase_13 AC 123 ms
56,156 KB
testcase_14 AC 121 ms
56,208 KB
testcase_15 AC 125 ms
56,180 KB
testcase_16 AC 123 ms
55,640 KB
testcase_17 AC 124 ms
55,932 KB
testcase_18 AC 126 ms
55,460 KB
testcase_19 AC 124 ms
55,760 KB
testcase_20 AC 126 ms
55,380 KB
testcase_21 AC 125 ms
55,932 KB
testcase_22 AC 125 ms
55,856 KB
testcase_23 AC 124 ms
56,304 KB
testcase_24 AC 126 ms
55,604 KB
testcase_25 AC 124 ms
55,976 KB
testcase_26 AC 126 ms
55,904 KB
testcase_27 AC 131 ms
55,928 KB
testcase_28 AC 129 ms
56,100 KB
testcase_29 AC 132 ms
55,948 KB
testcase_30 AC 130 ms
55,852 KB
testcase_31 AC 133 ms
55,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] etoes = new String[]{"ne", "ushi", "tora", "u", "tatsu", "mi", "uma", "hitsuji", "saru", "tori", "inu", "i"};
		HashMap<String, Integer> idxes = new HashMap<>();
		for (int i = 0; i < etoes.length; i++) {
		    idxes.put(etoes[i], i);
		}
		int[] counts = new int[etoes.length];
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
		    counts[idxes.get(sc.next())]++;
		}
		Arrays.sort(counts);
		if (counts[counts.length - 1] > (n + 1) / 2) {
		    System.out.println("NO");
		} else {
		    System.out.println("YES");
		}
	}
}
0