結果

問題 No.443 GCD of Permutation
コンテスト
ユーザー pluto77
提出日時 2016-11-26 08:46:28
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 243 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 139 ms
コンパイル使用メモリ 76,996 KB
最終ジャッジ日時 2025-12-03 22:48:48
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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