結果

問題 No.39 桁の数字を入れ替え
ユーザー purple_jwlpurple_jwl
提出日時 2016-10-27 13:25:41
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,142 ms / 5,000 ms
コード長 371 bytes
コンパイル時間 8,859 ms
コンパイル使用メモリ 261,300 KB
実行使用メモリ 61,896 KB
最終ジャッジ日時 2023-09-12 06:41:22
合計ジャッジ時間 30,486 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 937 ms
61,524 KB
testcase_01 AC 940 ms
61,644 KB
testcase_02 AC 946 ms
61,440 KB
testcase_03 AC 934 ms
61,800 KB
testcase_04 AC 944 ms
61,628 KB
testcase_05 AC 969 ms
61,668 KB
testcase_06 AC 976 ms
61,556 KB
testcase_07 AC 974 ms
61,896 KB
testcase_08 AC 950 ms
61,544 KB
testcase_09 AC 959 ms
61,524 KB
testcase_10 AC 952 ms
61,796 KB
testcase_11 AC 945 ms
61,892 KB
testcase_12 AC 942 ms
61,820 KB
testcase_13 AC 946 ms
61,548 KB
testcase_14 AC 955 ms
61,844 KB
testcase_15 AC 951 ms
61,592 KB
testcase_16 AC 950 ms
61,872 KB
testcase_17 AC 1,117 ms
61,732 KB
testcase_18 AC 1,142 ms
61,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val n = StdIn.readLine().toArray
    val sz = n.size

    var ans: Long = 0
    for (i <- (0 until sz); j <- (i until sz)) {
      val tmp = n.clone
      val ch = tmp(i)
      tmp(i) = tmp(j)
      tmp(j) = ch
      ans = Math.max(ans, tmp.mkString.toLong)
    }

    println(ans)
  }
}
0