結果

問題 No.349 干支の置き物
ユーザー viptnetviptnet
提出日時 2016-11-06 15:51:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 859 bytes
コンパイル時間 3,709 ms
コンパイル使用メモリ 75,404 KB
実行使用メモリ 41,396 KB
最終ジャッジ日時 2024-05-03 22:21:56
合計ジャッジ時間 8,217 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
41,040 KB
testcase_01 AC 123 ms
41,152 KB
testcase_02 AC 113 ms
39,888 KB
testcase_03 AC 118 ms
40,348 KB
testcase_04 AC 129 ms
41,048 KB
testcase_05 AC 122 ms
41,080 KB
testcase_06 AC 113 ms
39,908 KB
testcase_07 AC 125 ms
41,284 KB
testcase_08 AC 132 ms
41,136 KB
testcase_09 AC 130 ms
40,932 KB
testcase_10 AC 126 ms
41,328 KB
testcase_11 AC 120 ms
40,540 KB
testcase_12 AC 128 ms
41,236 KB
testcase_13 AC 118 ms
39,908 KB
testcase_14 AC 119 ms
40,204 KB
testcase_15 AC 127 ms
40,988 KB
testcase_16 AC 127 ms
41,036 KB
testcase_17 AC 113 ms
40,032 KB
testcase_18 AC 112 ms
39,948 KB
testcase_19 AC 118 ms
40,484 KB
testcase_20 AC 124 ms
41,008 KB
testcase_21 AC 122 ms
40,980 KB
testcase_22 AC 122 ms
40,896 KB
testcase_23 AC 126 ms
41,396 KB
testcase_24 AC 126 ms
41,188 KB
testcase_25 AC 114 ms
39,988 KB
testcase_26 AC 126 ms
40,928 KB
testcase_27 AC 123 ms
41,280 KB
testcase_28 AC 132 ms
41,116 KB
testcase_29 AC 126 ms
40,108 KB
testcase_30 AC 126 ms
41,128 KB
testcase_31 AC 111 ms
39,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class No349 {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String,Integer> map = new HashMap<String, Integer>();
    
        for (int i = 0; i < n; i++) {
        	String eto = sc.next();
        	if (map.containsKey(eto)) {
        		map.put(eto, map.get(eto) + 1);
        	} else {
        		map.put(eto, 1);
        	}
        }
        int max = 0;
        for(Entry<String, Integer> e : map.entrySet()) {
            if(max < e.getValue()) {
            	max = e.getValue();
            }
        }
        if ((n+1)/2 >= max) {
        	System.out.println("YES");
        }else {
        	System.out.println("NO");
        }

	}

}
0