結果

問題 No.443 GCD of Permutation
コンテスト
ユーザー AEn
提出日時 2023-05-24 01:19:39
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 34 ms / 1,000 ms
+ 28µs
コード長 284 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 77 ms
コンパイル使用メモリ 64,472 KB
実行使用メモリ 53,552 KB
最終ジャッジ日時 2026-10-17 12:20:09
合計ジャッジ時間 3,445 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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