結果

問題 No.443 GCD of Permutation
ユーザー tktk_snsn
提出日時 2020-11-29 22:14:21
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 393 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 68,428 KB
最終ジャッジ日時 2024-09-13 02:10:32
合計ジャッジ時間 3,076 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 RE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from itertools import permutations
from math import gcd


def main():
    S = input()
    C = Counter(S)

    if len(C) == 1:
        return S

    keys = C.keys()
    res = int(S)
    for a in keys:
        a = int(a)
        for b in keys:
            b = int(b)
            if a > b:
                res = gcd(res, 9 * (a - b))
    return res


print(main())
0