結果

問題 No.349 干支の置き物
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-05-04 19:28:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 1,202 bytes
コンパイル時間 2,374 ms
コンパイル使用メモリ 74,936 KB
実行使用メモリ 51,144 KB
最終ジャッジ日時 2023-10-12 08:06:34
合計ジャッジ時間 5,490 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,208 KB
testcase_01 AC 45 ms
49,208 KB
testcase_02 AC 45 ms
49,436 KB
testcase_03 AC 45 ms
49,048 KB
testcase_04 AC 45 ms
51,144 KB
testcase_05 AC 46 ms
49,260 KB
testcase_06 AC 46 ms
49,184 KB
testcase_07 AC 45 ms
49,304 KB
testcase_08 AC 46 ms
49,144 KB
testcase_09 AC 44 ms
49,240 KB
testcase_10 AC 45 ms
49,196 KB
testcase_11 AC 45 ms
49,248 KB
testcase_12 AC 46 ms
49,792 KB
testcase_13 AC 46 ms
49,244 KB
testcase_14 AC 44 ms
49,104 KB
testcase_15 AC 45 ms
49,240 KB
testcase_16 AC 44 ms
49,296 KB
testcase_17 AC 45 ms
49,160 KB
testcase_18 AC 45 ms
49,112 KB
testcase_19 AC 45 ms
49,304 KB
testcase_20 AC 47 ms
49,144 KB
testcase_21 AC 47 ms
49,232 KB
testcase_22 AC 46 ms
49,108 KB
testcase_23 AC 46 ms
49,096 KB
testcase_24 AC 44 ms
47,460 KB
testcase_25 AC 45 ms
49,532 KB
testcase_26 AC 45 ms
49,136 KB
testcase_27 AC 47 ms
49,300 KB
testcase_28 AC 45 ms
49,228 KB
testcase_29 AC 45 ms
49,420 KB
testcase_30 AC 45 ms
49,216 KB
testcase_31 AC 45 ms
49,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        int N = Integer.parseInt(reader.readLine());

        String[] ornaments = new String[]{"ne", "ushi", "tora", "u", "tatsu", "mi", "uma", "hitsuji", "saru", "tori", "inu", "i"};
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < 12; i++) {
            map.put(ornaments[i], i);
        }
        int[] table = new int[12];
        for (int i = 0; i < N; i++) {
            String ornament = reader.readLine();
            table[map.get(ornament)] += 1;
        }

        int max = Integer.MIN_VALUE;
        for (int i = 0; i < 12; i++) {
            max = Math.max(max, table[i]);
        }

        String answer = "YES";
        for (int i = 0; i < 12; i++) {
            if (table[i] > ((N+1) / 2)) {
                answer="NO";
                break;
            }
        }
        System.out.println(answer);
    }
}
0