結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 944 ms
62,500 KB
testcase_01 AC 961 ms
62,312 KB
testcase_02 AC 958 ms
62,272 KB
testcase_03 AC 948 ms
62,308 KB
testcase_04 AC 937 ms
62,296 KB
testcase_05 AC 955 ms
62,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

object Main {
  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