結果

問題 No.443 GCD of Permutation
ユーザー aRacaRac
提出日時 2016-11-23 20:03:32
言語 Scala(Beta)
(3.4.0)
結果
TLE  
実行時間 -
コード長 243 bytes
コンパイル時間 11,829 ms
コンパイル使用メモリ 250,972 KB
実行使用メモリ 70,984 KB
最終ジャッジ日時 2023-09-12 07:33:04
合計ジャッジ時間 27,345 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 958 ms
67,808 KB
testcase_01 AC 969 ms
62,868 KB
testcase_02 AC 968 ms
63,000 KB
testcase_03 AC 970 ms
62,864 KB
testcase_04 TLE -
testcase_05 AC 969 ms
62,796 KB
testcase_06 AC 964 ms
62,772 KB
testcase_07 TLE -
testcase_08 AC 968 ms
62,892 KB
testcase_09 AC 949 ms
63,012 KB
testcase_10 AC 968 ms
63,068 KB
testcase_11 AC 971 ms
62,944 KB
testcase_12 AC 963 ms
62,900 KB
testcase_13 AC 966 ms
62,872 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

object Main {
    def gcd(n: BigInt, m: BigInt): BigInt = if (n % m == 0) m else gcd(m, n % m)

    def solve(n: String) = n.permutations.map(d => BigInt(d)).reduce(gcd)

    def main(args: Array[String]) = println(solve(io.StdIn.readLine))
}
0