結果

問題 No.443 GCD of Permutation
ユーザー pluto77
提出日時 2016-11-26 08:46:28
言語 Python2
(2.7.18)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 243 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-14 00:03:43
合計ジャッジ時間 1,789 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki443

def gcd(a, b):
 while b:
  a, b = b, a % b
 return a
 
n=raw_input()
s=set()

for c in n:
 s.add(int(c))

if len(s) == 1:
 print n
else:
 res=0
 for x in s:
  for y in s:
   if x > y:
	res = gcd(res, 9*(x-y))

 print gcd(res,int(n))
0