結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー nnsniconnsnico
提出日時 2019-05-01 16:09:43
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 11,054 ms
コンパイル使用メモリ 257,028 KB
実行使用メモリ 63,112 KB
最終ジャッジ日時 2023-09-14 16:11:46
合計ジャッジ時間 26,722 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 933 ms
61,868 KB
testcase_01 AC 928 ms
61,812 KB
testcase_02 AC 927 ms
61,964 KB
testcase_03 AC 942 ms
61,888 KB
testcase_04 AC 929 ms
62,576 KB
testcase_05 AC 950 ms
61,872 KB
testcase_06 AC 941 ms
62,192 KB
testcase_07 AC 933 ms
62,200 KB
testcase_08 AC 937 ms
62,092 KB
testcase_09 WA -
testcase_10 AC 934 ms
62,172 KB
testcase_11 AC 937 ms
61,696 KB
testcase_12 AC 923 ms
61,608 KB
testcase_13 WA -
testcase_14 AC 935 ms
61,928 KB
testcase_15 AC 936 ms
61,816 KB
testcase_16 AC 941 ms
61,680 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("^(?!00)[0-9]{1,5}")) {
    Some(a.toInt)
  } else {
    None
  }

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

  val ans = for {
    a <- aIntOpt
    b <- bIntOpt
    if (a + b) <= 12345
  } yield {
    a + b
  }

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