結果

問題 No.349 干支の置き物
ユーザー atkrymatkrym
提出日時 2016-11-07 23:08:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 1,307 bytes
コンパイル時間 1,936 ms
コンパイル使用メモリ 74,676 KB
実行使用メモリ 56,332 KB
最終ジャッジ日時 2023-08-16 14:44:19
合計ジャッジ時間 7,450 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,968 KB
testcase_01 AC 119 ms
55,860 KB
testcase_02 AC 119 ms
56,016 KB
testcase_03 AC 119 ms
55,708 KB
testcase_04 AC 124 ms
55,720 KB
testcase_05 AC 120 ms
55,880 KB
testcase_06 AC 125 ms
56,300 KB
testcase_07 AC 124 ms
55,676 KB
testcase_08 AC 126 ms
56,268 KB
testcase_09 AC 122 ms
55,972 KB
testcase_10 AC 124 ms
56,076 KB
testcase_11 AC 124 ms
55,676 KB
testcase_12 AC 128 ms
56,052 KB
testcase_13 AC 126 ms
56,252 KB
testcase_14 AC 123 ms
56,092 KB
testcase_15 AC 125 ms
56,332 KB
testcase_16 AC 123 ms
55,892 KB
testcase_17 AC 120 ms
56,108 KB
testcase_18 AC 120 ms
55,704 KB
testcase_19 AC 124 ms
56,072 KB
testcase_20 AC 121 ms
55,752 KB
testcase_21 AC 120 ms
55,888 KB
testcase_22 AC 120 ms
55,852 KB
testcase_23 AC 119 ms
55,692 KB
testcase_24 AC 117 ms
55,724 KB
testcase_25 AC 120 ms
55,876 KB
testcase_26 AC 124 ms
55,648 KB
testcase_27 AC 126 ms
56,060 KB
testcase_28 AC 122 ms
55,720 KB
testcase_29 AC 124 ms
55,716 KB
testcase_30 AC 126 ms
55,800 KB
testcase_31 AC 125 ms
55,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int[] ary = new int[12];
        for (int i = 0;i < n;i++) {
            String s = sc.next();
            if (s.equals("ne")) ary[0]++;
            if (s.equals("ushi")) ary[1]++;
            if (s.equals("tora")) ary[2]++;
            if (s.equals("u")) ary[3]++;
            if (s.equals("tatsu")) ary[4]++;
            if (s.equals("mi")) ary[5]++;
            if (s.equals("uma")) ary[6]++;
            if (s.equals("hitsuji")) ary[7]++;
            if (s.equals("saru")) ary[8]++;
            if (s.equals("tori")) ary[9]++;
            if (s.equals("inu")) ary[10]++;
            if (s.equals("i")) ary[11]++;
        }
        int max = 0;
        for (int i = 0;i < 12;i++) {
            max = Math.max(max,ary[i]);
        }
        if (n%2==0) {
            if (max>n/2) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
            }
        } else {
            if (max>(n+1)/2) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
            }
        }
    }
}
0