結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー nnsniconnsnico
提出日時 2019-05-01 15:42:52
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 8,478 ms
コンパイル使用メモリ 256,440 KB
実行使用メモリ 62,708 KB
最終ジャッジ日時 2023-09-14 16:13:56
合計ジャッジ時間 26,116 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 923 ms
61,652 KB
testcase_01 AC 926 ms
61,672 KB
testcase_02 AC 925 ms
61,752 KB
testcase_03 AC 925 ms
61,912 KB
testcase_04 AC 933 ms
61,884 KB
testcase_05 AC 943 ms
62,016 KB
testcase_06 WA -
testcase_07 AC 916 ms
61,896 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 922 ms
61,888 KB
testcase_11 AC 911 ms
61,544 KB
testcase_12 AC 938 ms
62,708 KB
testcase_13 AC 942 ms
61,800 KB
testcase_14 AC 937 ms
61,772 KB
testcase_15 AC 933 ms
61,940 KB
testcase_16 AC 937 ms
62,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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