結果

問題 No.443 GCD of Permutation
ユーザー nola_suz
提出日時 2016-11-12 01:15:41
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 252 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,472 KB
最終ジャッジ日時 2024-10-13 23:47:18
合計ジャッジ時間 5,677 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 3
other AC * 1 RE * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
import fractions
s = input()
n = int(s)
a = [0]*10
for i in s:
	a[int(i)]+=1

ans = n

for i in range(10):
	for j in range(i):
		if a[i] and a[j]:
			if ans < 0:
				ans = 9*(i-j)
			else:
				ans = fractions.gcd(ans, 9*(i-j))

print(ans)
0