結果

問題 No.349 干支の置き物
ユーザー tsunabittsunabit
提出日時 2019-05-28 00:06:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,107 bytes
コンパイル時間 3,627 ms
コンパイル使用メモリ 79,872 KB
実行使用メモリ 57,848 KB
最終ジャッジ日時 2023-10-17 18:20:45
合計ジャッジ時間 9,425 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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;
        }
        System.out.println(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