結果

問題 No.349 干支の置き物
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 21:33:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 824 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 72,196 KB
実行使用メモリ 56,536 KB
最終ジャッジ日時 2023-08-17 04:23:40
合計ジャッジ時間 9,140 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,964 KB
testcase_01 AC 120 ms
55,584 KB
testcase_02 WA -
testcase_03 AC 122 ms
55,876 KB
testcase_04 AC 129 ms
55,624 KB
testcase_05 AC 129 ms
55,596 KB
testcase_06 AC 128 ms
55,780 KB
testcase_07 AC 128 ms
55,908 KB
testcase_08 AC 128 ms
55,656 KB
testcase_09 AC 127 ms
55,780 KB
testcase_10 AC 125 ms
55,672 KB
testcase_11 AC 127 ms
55,828 KB
testcase_12 AC 125 ms
55,664 KB
testcase_13 AC 127 ms
55,732 KB
testcase_14 AC 127 ms
55,792 KB
testcase_15 AC 126 ms
55,868 KB
testcase_16 AC 127 ms
55,460 KB
testcase_17 AC 123 ms
55,572 KB
testcase_18 AC 122 ms
55,644 KB
testcase_19 AC 122 ms
55,816 KB
testcase_20 AC 122 ms
55,532 KB
testcase_21 WA -
testcase_22 AC 139 ms
55,648 KB
testcase_23 AC 138 ms
55,492 KB
testcase_24 AC 147 ms
55,488 KB
testcase_25 AC 149 ms
53,544 KB
testcase_26 AC 155 ms
55,312 KB
testcase_27 AC 149 ms
55,584 KB
testcase_28 AC 151 ms
56,224 KB
testcase_29 AC 164 ms
55,300 KB
testcase_30 AC 158 ms
53,916 KB
testcase_31 AC 142 ms
55,640 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