結果

問題 No.197 手品
ユーザー 💕💖💞💕💖💞
提出日時 2016-09-20 18:25:50
言語 Scala(Beta)
(3.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,287 bytes
コンパイル時間 4,475 ms
コンパイル使用メモリ 214,276 KB
最終ジャッジ日時 2023-09-12 06:26:38
合計ジャッジ時間 5,257 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
-- [E040] Syntax Error: Main.scala:10:31 ---------------------------------------
10 |  def main(args: Array[String]){
   |                               ^
   |                               '=' expected, but '{' found
-- [E008] Not Found Error: Main.scala:2:34 -------------------------------------
2 |import scala.collection.immutable.StringLike
  |                                  ^^^^^^^^^^
  |            value StringLike is not a member of scala.collection.immutable
-- [E008] Not Found Error: Main.scala:6:37 -------------------------------------
6 |import scala.collection.mutable.{Map,SynchronizedMap, HashMap}
  |                                     ^^^^^^^^^^^^^^^
  |         value SynchronizedMap is not a member of scala.collection.mutable
3 errors found

ソースコード

diff #

import scala.io.StdIn.readLine
import scala.collection.immutable.StringLike
import scala.collection.immutable.Stream
import Math.{sqrt, pow}
import scala.util.control.Breaks
import scala.collection.mutable.{Map,SynchronizedMap, HashMap}
import scala.collection.mutable.{ListBuffer}
import scala.math.{ BigDecimal }
object Main {
  def main(args: Array[String]){
    val ins  = readLine().replaceAll("o", "1").replaceAll("x", "0")
    val n    = readLine().toInt
    val outs = readLine().replaceAll("o", "1").replaceAll("x", "0")
    val sints = ins.toList.sortBy(_.toInt)
    val souts = outs.toList.sortBy(_.toInt)
    if (sints != souts) {
      println("SUCCESS")
      return
    }
    if (n >= 2 ) {
      println("FAILURE")       
      return 
    }   
    if ( n == 0) {
      if ( ins != outs ) println("SUCCESS")
      else println("FAILURE")
      return
    }   
    val m:Map[String, List[String]] = Map( "111" -> List("111"), "000" -> List("000"), "100" -> List("100", "010"), "010" -> List("100", "001"), "110" -> List("110", "101"), "011" -> List("101", "011"), "001" -> List("001", "010"), "101" -> List("011", "110") )
    if ( n == 1 ) { 
      val swappable = m(ins).contains(outs)
      if (swappable) println("FAILURE")
      else println("SUCCESS")
    }   
  }
}
0