結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-23 20:03:32 |
| 言語 | Scala(Beta) (3.6.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 243 bytes |
| コンパイル時間 | 9,797 ms |
| コンパイル使用メモリ | 257,028 KB |
| 実行使用メモリ | 77,076 KB |
| 最終ジャッジ日時 | 2024-06-29 20:29:14 |
| 合計ジャッジ時間 | 26,140 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 TLE * 2 -- * 16 |
ソースコード
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))
}