結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー HujiLee
提出日時 2016-11-26 00:35:58
言語 Scala(Beta)
(3.6.2)
結果
AC  
実行時間 889 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 8,366 ms
コンパイル使用メモリ 259,432 KB
実行使用メモリ 62,560 KB
最終ジャッジ日時 2024-06-29 20:35:21
合計ジャッジ時間 24,530 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn

/**
  * Created by Administrator on 2016/11/25 0025.
  */
object Main extends App {
  def ng(): Unit = {
    println("NG")
  }

  def ok(): Unit = {
    println("OK")
  }

  def leadingZero(str:String):Boolean={
    return (str.charAt(0)=='0'&&str.length>1)
  }

  try {
    var A = StdIn.readLine()
    var B = StdIn.readLine()
    if (leadingZero(A)||leadingZero(B)) {
      throw new Exception("leading zero")
    }
    var (a, b) = (A.toInt, B.toInt)
    if (math.max(a, b) > 12345) {
      throw new Exception("> 12345")
    }
    ok()

  } catch {
    case ex: Exception => {
      Console.err.println(ex)
      ng()
    }
  }


}
0