結果

問題 No.443 GCD of Permutation
ユーザー はむ吉🐹
提出日時 2016-11-14 22:52:26
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 354 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 89,216 KB
最終ジャッジ日時 2024-11-26 01:25:57
合計ジャッジ時間 5,731 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3

import fractions
import functools
import itertools


def gcd_of_permutations(n):
    ds = (int(d) for d in str(n))
    xs = (9 * abs(a - b) for a, b in itertools.combinations(ds, 2))
    return functools.reduce(fractions.gcd, xs, n)


def main():
    print(gcd_of_permutations(int(input())))


if __name__ == '__main__':
    main()
0