結果

問題 No.349 干支の置き物
ユーザー tsunabittsunabit
提出日時 2019-05-28 00:07:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 1,074 bytes
コンパイル時間 3,762 ms
コンパイル使用メモリ 79,904 KB
実行使用メモリ 57,688 KB
最終ジャッジ日時 2023-10-17 18:20:56
合計ジャッジ時間 9,291 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,624 KB
testcase_01 AC 134 ms
57,396 KB
testcase_02 AC 134 ms
57,576 KB
testcase_03 AC 139 ms
57,492 KB
testcase_04 AC 147 ms
57,660 KB
testcase_05 AC 139 ms
57,440 KB
testcase_06 AC 140 ms
57,528 KB
testcase_07 AC 139 ms
57,452 KB
testcase_08 AC 139 ms
57,472 KB
testcase_09 AC 144 ms
57,660 KB
testcase_10 AC 142 ms
57,484 KB
testcase_11 AC 141 ms
57,668 KB
testcase_12 AC 140 ms
57,584 KB
testcase_13 AC 140 ms
57,432 KB
testcase_14 AC 138 ms
57,352 KB
testcase_15 AC 139 ms
57,460 KB
testcase_16 AC 139 ms
57,404 KB
testcase_17 AC 136 ms
57,460 KB
testcase_18 AC 134 ms
57,688 KB
testcase_19 AC 134 ms
57,628 KB
testcase_20 AC 132 ms
57,304 KB
testcase_21 AC 135 ms
57,440 KB
testcase_22 AC 132 ms
57,424 KB
testcase_23 AC 133 ms
57,540 KB
testcase_24 AC 132 ms
57,424 KB
testcase_25 AC 136 ms
57,504 KB
testcase_26 AC 138 ms
57,452 KB
testcase_27 AC 139 ms
57,612 KB
testcase_28 AC 140 ms
57,428 KB
testcase_29 AC 139 ms
57,684 KB
testcase_30 AC 143 ms
57,624 KB
testcase_31 AC 140 ms
57,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No349 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner s = new Scanner(System.in);
        Map<String, Integer> eto = new HashMap<String, Integer>() {{ put("ne", 0); put("ushi", 0); put("tora", 0); put("u", 0); put("tatsu", 0); put("mi", 0); put("uma", 0); put("hitsuji", 0); put("saru", 0); put("tori", 0); put("inu", 0); put("i", 0);}};
        int n = s.nextInt();
        for(int i = 0; i < n; i++) {
        	String temp = s.next();
        	eto.put(temp, eto.get(temp) + 1);
        }
        int max = 0;
        for(int c : eto.values()) {
        	max = max < c? c : max;
        }
        if(n % 2 == 0) {
        	if(max > (n / 2)) {
            	System.out.println("NO");
            }else {
            	System.out.println("YES");
            }
        }else {
        	if(max > (n / 2) + 1) {
            	System.out.println("NO");
            }else {
            	System.out.println("YES");
            }
        }
    }
}
0