結果

問題 No.632 穴埋め門松列
ユーザー tetsutetsu
提出日時 2018-01-19 21:31:10
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 946 ms / 1,000 ms
コード長 903 bytes
コンパイル時間 7,366 ms
コンパイル使用メモリ 242,192 KB
実行使用メモリ 62,636 KB
最終ジャッジ日時 2023-09-12 15:42:23
合計ジャッジ時間 14,338 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 929 ms
62,636 KB
testcase_01 AC 928 ms
62,448 KB
testcase_02 AC 934 ms
62,484 KB
testcase_03 AC 936 ms
62,404 KB
testcase_04 AC 946 ms
62,428 KB
testcase_05 AC 928 ms
62,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

object A {
  def kadomatsu(n1 :Int, n2: Int, n3: Int): Boolean = {
    if(n1 < n2 && n2 > n3) {
      return true
    }
    if(n1 > n2 && n2 < n3) {
      return true
    }
    return false
  }
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val c1, c2, c3 = sc.next()
    if(c1=="?") {
      val n2 = c2.toInt
      val n3 = c3.toInt
      if(kadomatsu(1, n2, n3)) {
        print(1)
      }
      if(kadomatsu(4, n2, n3)) {
        print(4)
      }
    } else if(c2=="?") {
      val n1 = c1.toInt
      val n3 = c3.toInt
      if(kadomatsu(n1, 1, n3)) {
        print(1)
      }
      if(kadomatsu(n1, 4, n3)) {
        print(4)
      }
    } else {
      val n1 = c1.toInt
      val n2 = c2.toInt
      if(kadomatsu(n1, n2, 1)) {
        print(1)
      }
      if(kadomatsu(n1, n2, 4)) {
        print(4)
      }
    }
    println()
  }
}
0