結果

問題 No.443 GCD of Permutation
コンテスト
ユーザー nebukuro09
提出日時 2016-11-12 09:11:37
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 119 ms / 1,000 ms
+ 403µs
コード長 236 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 78 ms
コンパイル使用メモリ 62,396 KB
実行使用メモリ 81,952 KB
最終ジャッジ日時 2026-10-17 09:49:06
合計ジャッジ時間 6,414 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from fractions import gcd

N = raw_input()
S = set(N)

if len(S) == 1:
    print N
    exit()

g = reduce(gcd, [abs(9*(int(a)-int(b))) for a in S for b in S if a != b])
print max(i for i in xrange(1, g+1) if g%i == 0 and int(N)%i == 0)
0