結果

問題 No.349 干支の置き物
ユーザー negistelnegistel
提出日時 2016-05-15 02:23:08
言語 Scala(Beta)
(3.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 360 bytes
コンパイル時間 5,542 ms
コンパイル使用メモリ 235,372 KB
最終ジャッジ日時 2023-09-12 00:38:20
合計ジャッジ時間 6,140 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
-- [E006] Not Found Error: Main.scala:3:12 -------------------------------------
3 |    val n = readInt()
  |            ^^^^^^^
  |            Not found: readInt
  |
  | longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: Main.scala:6:14 -------------------------------------
6 |      val s = readLine()
  |              ^^^^^^^^
  |              Not found: readLine
  |
  | longer explanation available when compiling with `-explain`
2 errors found

ソースコード

diff #

object Main {
  def main(args: Array[String]): Unit = {
    val n = readInt()
    val count = scala.collection.mutable.HashMap.empty[String, Int]
    for (_ <- 1 to n) {
      val s = readLine()
      if (!(count contains s)) count += (s -> 0)
      count(s) += 1
    }
    println {
      if (count.values.max > (n + 1) / 2) "NO"
      else "YES"
    }
  }
}
0