結果

問題 No.443 GCD of Permutation
ユーザー AEnAEn
提出日時 2023-05-24 01:19:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 284 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 82,272 KB
実行使用メモリ 54,656 KB
最終ジャッジ日時 2024-12-23 09:18:12
合計ジャッジ時間 3,081 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys
sys.set_int_max_str_digits(10**5)
S = int(input())

s = set(list(str(S)))
if len(s)==1:
    print(S)
else:
    mn = 10
    for a in s:
        for b in s:
            if a==b:continue
            mn = min(mn,abs(int(a)-int(b)))

    print(math.gcd(9*mn,S))
    
0