結果

問題 No.349 干支の置き物
ユーザー 37zigen37zigen
提出日時 2016-03-12 02:06:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 3,098 ms
コンパイル使用メモリ 83,004 KB
実行使用メモリ 41,908 KB
最終ジャッジ日時 2024-04-28 14:41:36
合計ジャッジ時間 8,207 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,476 KB
testcase_01 AC 125 ms
41,444 KB
testcase_02 AC 135 ms
41,208 KB
testcase_03 AC 119 ms
41,032 KB
testcase_04 AC 136 ms
41,788 KB
testcase_05 AC 127 ms
41,052 KB
testcase_06 AC 124 ms
41,308 KB
testcase_07 AC 127 ms
40,944 KB
testcase_08 AC 135 ms
41,436 KB
testcase_09 AC 132 ms
41,648 KB
testcase_10 AC 133 ms
41,528 KB
testcase_11 AC 132 ms
41,652 KB
testcase_12 AC 133 ms
41,908 KB
testcase_13 AC 144 ms
40,780 KB
testcase_14 AC 135 ms
41,512 KB
testcase_15 AC 134 ms
41,696 KB
testcase_16 AC 123 ms
41,624 KB
testcase_17 AC 118 ms
41,480 KB
testcase_18 AC 130 ms
41,620 KB
testcase_19 AC 132 ms
40,744 KB
testcase_20 AC 136 ms
41,752 KB
testcase_21 AC 134 ms
41,660 KB
testcase_22 AC 131 ms
41,412 KB
testcase_23 AC 118 ms
41,000 KB
testcase_24 AC 130 ms
41,828 KB
testcase_25 AC 127 ms
41,572 KB
testcase_26 AC 119 ms
41,392 KB
testcase_27 AC 120 ms
41,248 KB
testcase_28 AC 123 ms
41,444 KB
testcase_29 AC 134 ms
41,660 KB
testcase_30 AC 143 ms
41,708 KB
testcase_31 AC 131 ms
41,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package 練習;
import java.util.Date;
import java.util.HashMap;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		double n=sc.nextDouble();
		long exec_time=new Date().getTime();
		HashMap<String,Integer> map=new HashMap<>();
		for(int i=0;i<n;i++){
			String x=sc.next();
			if(!map.containsKey(x)){
				map.put(x, 1);
			}else{
				map.put(x,map.get(x)+1);
			}
		}
		int max=0;
		for(int v:map.values())max=Math.max(v, max);
		if(max*2 <= n+1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		System.err.println(new Date().getTime()-exec_time+"ms");

	}
}
0