結果

問題 No.446 ゆきこーだーの雨と雪 (1)
コンテスト
ユーザー nnsnico
提出日時 2019-05-01 15:42:52
言語 Scala(Beta)
(3.8.1)
コンパイル:
scalac _filename_
実行:
java -cp .:/home/linuxbrew/.linuxbrew/Cellar/scala/3.8.1/libexec/maven2/org/scala-lang/scala3-library_3/3.8.1/scala3-library_3-3.8.1.jar:/home/linuxbrew/.linuxbrew/Cellar/scala/3.8.1/libexec/maven2/org/scala-lang/scala-library/3.8.1/scala-library-3.8.1.jar _class_
結果
WA  
実行時間 -
コード長 464 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,162 ms
コンパイル使用メモリ 259,068 KB
実行使用メモリ 65,008 KB
最終ジャッジ日時 2026-03-09 16:46:42
合計ジャッジ時間 18,847 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

object Main extends App {
  val a: String = scala.io.StdIn.readLine()
  val b: String = scala.io.StdIn.readLine()

  val aIntOpt = if (a.matches("^(?!.0)[0-9]{1,5}") && a.toInt <= 12345) {
    Some(a.toInt)
  } else {
    None
  }

  val bIntOpt = if (b.matches("^(?!.0)[0-9]{1,5}") && a.toInt <= 12345) {
    Some(b.toInt)
  } else {
    None
  }

  val ans = for {
    a <- aIntOpt
    b <- bIntOpt
  } yield a + b

  println(if (ans.nonEmpty) "OK" else "NG")

}
0