結果

問題 No.446 ゆきこーだーの雨と雪 (1)
コンテスト
ユーザー HujiLee
提出日時 2016-11-26 00:35:58
言語 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_
結果
AC  
実行時間 348 ms / 2,000 ms
コード長 659 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 6,500 ms
コンパイル使用メモリ 258,648 KB
実行使用メモリ 64,876 KB
最終ジャッジ日時 2026-03-09 14:56:42
合計ジャッジ時間 12,576 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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