結果

問題 No.443 GCD of Permutation
ユーザー
提出日時 2016-11-12 19:30:26
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 293 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-11-25 21:28:05
合計ジャッジ時間 2,232 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 19 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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 = gcd(G, 9 * (x[0] - x[1]))
  print G
0