結果

問題 No.443 GCD of Permutation
コンテスト
ユーザー はむ吉🐹
提出日時 2016-11-14 22:52:26
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 354 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 192 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 86,016 KB
最終ジャッジ日時 2026-05-20 13:45:42
合計ジャッジ時間 6,665 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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