結果
| 問題 | No.443 GCD of Permutation | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-11-12 19:32:50 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 56 ms / 1,000 ms | 
| コード長 | 297 bytes | 
| コンパイル時間 | 47 ms | 
| コンパイル使用メモリ | 6,944 KB | 
| 実行使用メモリ | 8,192 KB | 
| 最終ジャッジ日時 | 2024-10-13 23:48:38 | 
| 合計ジャッジ時間 | 1,904 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 28 | 
ソースコード
from itertools import product
from fractions import gcd
g = input()
digits = sorted(map(eval, str(g)))
if len(set(digits)) == 1:
  print g
else:
  digit_len = len(str(g))
  digits = list(set(digits))
  G = g
  for x in product(digits, repeat=2):
    G = abs(gcd(G, 9 * (x[0] - x[1])))
  print G
            
            
            
        