結果
| 問題 | No.443 GCD of Permutation | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-11-12 09:11:37 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 25 ms / 1,000 ms | 
| コード長 | 236 bytes | 
| コンパイル時間 | 75 ms | 
| コンパイル使用メモリ | 6,912 KB | 
| 実行使用メモリ | 8,192 KB | 
| 最終ジャッジ日時 | 2024-10-13 23:48:09 | 
| 合計ジャッジ時間 | 1,939 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 28 | 
ソースコード
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)
            
            
            
        