結果

問題 No.443 GCD of Permutation
ユーザー anubhavchk007anubhavchk007
提出日時 2024-01-12 04:41:41
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 82 ms / 1,000 ms
コード長 254 bytes
コンパイル時間 1,939 ms
コンパイル使用メモリ 76,916 KB
実行使用メモリ 78,452 KB
最終ジャッジ日時 2024-01-12 04:41:47
合計ジャッジ時間 5,199 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,892 KB
testcase_01 AC 69 ms
75,892 KB
testcase_02 AC 71 ms
75,892 KB
testcase_03 AC 70 ms
75,892 KB
testcase_04 AC 69 ms
75,892 KB
testcase_05 AC 73 ms
75,892 KB
testcase_06 AC 70 ms
75,892 KB
testcase_07 AC 70 ms
75,892 KB
testcase_08 AC 70 ms
75,892 KB
testcase_09 AC 71 ms
75,892 KB
testcase_10 AC 70 ms
75,892 KB
testcase_11 AC 68 ms
75,892 KB
testcase_12 AC 69 ms
75,892 KB
testcase_13 AC 69 ms
75,892 KB
testcase_14 AC 82 ms
77,428 KB
testcase_15 AC 72 ms
77,556 KB
testcase_16 AC 72 ms
77,556 KB
testcase_17 AC 75 ms
77,556 KB
testcase_18 AC 73 ms
77,556 KB
testcase_19 AC 71 ms
77,556 KB
testcase_20 AC 71 ms
77,556 KB
testcase_21 AC 71 ms
77,556 KB
testcase_22 AC 70 ms
76,020 KB
testcase_23 AC 70 ms
76,020 KB
testcase_24 AC 70 ms
76,020 KB
testcase_25 AC 77 ms
78,452 KB
testcase_26 AC 77 ms
78,452 KB
testcase_27 AC 75 ms
77,556 KB
testcase_28 AC 72 ms
77,556 KB
testcase_29 AC 75 ms
77,556 KB
testcase_30 AC 71 ms
77,556 KB
testcase_31 AC 74 ms
77,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math

def gcd(a, b):
	return a if b == 0 else gcd(b, a%b)

N = raw_input()
S = set()

for c in N:
	S.add(int(c))

if len(S) == 1:
	print N
else:
	G = 0
	for y in S:
		for x in S:
			if y > x:
				G = gcd(G, 9*(y-x))
	print gcd(int(N),G)
0