結果

問題 No.349 干支の置き物
ユーザー atkrymatkrym
提出日時 2016-11-07 23:08:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 1,307 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 78,168 KB
実行使用メモリ 41,404 KB
最終ジャッジ日時 2024-05-03 23:02:19
合計ジャッジ時間 7,596 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,404 KB
testcase_01 AC 132 ms
40,860 KB
testcase_02 AC 116 ms
39,892 KB
testcase_03 AC 129 ms
41,168 KB
testcase_04 AC 137 ms
41,224 KB
testcase_05 AC 122 ms
40,060 KB
testcase_06 AC 139 ms
41,232 KB
testcase_07 AC 136 ms
41,120 KB
testcase_08 AC 136 ms
41,172 KB
testcase_09 AC 137 ms
41,236 KB
testcase_10 AC 134 ms
41,004 KB
testcase_11 AC 136 ms
41,040 KB
testcase_12 AC 134 ms
41,260 KB
testcase_13 AC 135 ms
41,252 KB
testcase_14 AC 135 ms
41,084 KB
testcase_15 AC 134 ms
40,864 KB
testcase_16 AC 136 ms
41,024 KB
testcase_17 AC 128 ms
40,864 KB
testcase_18 AC 134 ms
41,128 KB
testcase_19 AC 136 ms
40,892 KB
testcase_20 AC 136 ms
41,056 KB
testcase_21 AC 134 ms
41,136 KB
testcase_22 AC 118 ms
39,852 KB
testcase_23 AC 134 ms
41,232 KB
testcase_24 AC 130 ms
41,152 KB
testcase_25 AC 135 ms
41,012 KB
testcase_26 AC 137 ms
41,172 KB
testcase_27 AC 126 ms
39,852 KB
testcase_28 AC 136 ms
40,904 KB
testcase_29 AC 141 ms
41,340 KB
testcase_30 AC 140 ms
41,308 KB
testcase_31 AC 141 ms
40,904 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