結果

問題 No.349 干支の置き物
ユーザー tsuchinaga
提出日時 2019-02-27 13:20:13
言語 Go
(1.23.4)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 380 bytes
コンパイル時間 12,160 ms
コンパイル使用メモリ 228,852 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 05:07:45
合計ジャッジ時間 11,280 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func main() {
	var n, max int
	s := ""
	_, _ = fmt.Scan(&n)
	e := make(map[string]int, 0)
	for i := 0; i < n; i++ {
		_, _ = fmt.Scan(&s)
		if _, ok := e[s]; ok {
			e[s]++
		} else {
			e[s] = 1
		}

		if max < e[s] {
			max = e[s]
		}
	}

	if int(math.Ceil(float64(n)/2)) >= max {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0