結果

問題 No.349 干支の置き物
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 21:36:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 4,501 ms
コンパイル使用メモリ 72,384 KB
実行使用メモリ 55,828 KB
最終ジャッジ日時 2023-08-17 04:24:09
合計ジャッジ時間 8,307 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
55,800 KB
testcase_01 AC 132 ms
55,540 KB
testcase_02 AC 135 ms
55,724 KB
testcase_03 AC 139 ms
55,560 KB
testcase_04 AC 141 ms
55,240 KB
testcase_05 AC 143 ms
55,792 KB
testcase_06 AC 141 ms
55,564 KB
testcase_07 AC 139 ms
55,532 KB
testcase_08 AC 140 ms
55,228 KB
testcase_09 AC 139 ms
55,544 KB
testcase_10 AC 129 ms
55,496 KB
testcase_11 AC 129 ms
55,236 KB
testcase_12 AC 129 ms
55,284 KB
testcase_13 AC 127 ms
55,580 KB
testcase_14 AC 130 ms
55,828 KB
testcase_15 AC 127 ms
55,620 KB
testcase_16 AC 145 ms
55,748 KB
testcase_17 AC 141 ms
55,576 KB
testcase_18 AC 140 ms
55,604 KB
testcase_19 AC 142 ms
55,816 KB
testcase_20 AC 138 ms
55,520 KB
testcase_21 AC 139 ms
55,224 KB
testcase_22 AC 139 ms
55,524 KB
testcase_23 AC 137 ms
55,804 KB
testcase_24 AC 136 ms
55,292 KB
testcase_25 AC 146 ms
55,224 KB
testcase_26 AC 140 ms
55,764 KB
testcase_27 AC 153 ms
55,800 KB
testcase_28 AC 149 ms
55,508 KB
testcase_29 AC 149 ms
55,580 KB
testcase_30 AC 154 ms
55,288 KB
testcase_31 AC 143 ms
55,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int h = (N+1)/2;
        String [] E = {"ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i"};
        String [] A = new String [N];
        int [] B = new int [12];
        int max = 0;
        for(int i=0; i<N; i++){
            A[i] = sc.next();
            for(int j=0; j<12; j++){
                if( E[j].equals(A[i]) ){
                    B[j]++;
                    max = Math.max(max, B[j]);
                    break;
                }
            }
            if(max>h){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
0