結果

問題 No.443 GCD of Permutation
ユーザー しらっ亭しらっ亭
提出日時 2017-06-23 00:29:28
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 296 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 8,108 KB
最終ジャッジ日時 2023-10-12 00:13:43
合計ジャッジ時間 2,613 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,976 KB
testcase_01 AC 18 ms
8,032 KB
testcase_02 AC 18 ms
8,032 KB
testcase_03 AC 16 ms
7,932 KB
testcase_04 AC 16 ms
7,856 KB
testcase_05 AC 17 ms
7,908 KB
testcase_06 AC 16 ms
8,036 KB
testcase_07 AC 16 ms
7,912 KB
testcase_08 AC 17 ms
7,988 KB
testcase_09 AC 17 ms
7,948 KB
testcase_10 AC 16 ms
7,980 KB
testcase_11 AC 17 ms
7,960 KB
testcase_12 AC 16 ms
7,912 KB
testcase_13 AC 17 ms
8,048 KB
testcase_14 RE -
testcase_15 AC 17 ms
8,048 KB
testcase_16 AC 17 ms
7,904 KB
testcase_17 AC 17 ms
7,880 KB
testcase_18 RE -
testcase_19 AC 17 ms
7,904 KB
testcase_20 RE -
testcase_21 AC 17 ms
7,936 KB
testcase_22 AC 16 ms
7,864 KB
testcase_23 AC 16 ms
7,916 KB
testcase_24 AC 17 ms
7,944 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

s = input()

arr = [0] * 10

for c in s:
    arr[ord(c) - ord('0')] += 1

g = 0

for a in range(10):
    if arr[a] == 0:
        continue
    for b in range(a):
        if arr[b] == 0:
            continue

        g = gcd(g, 9 * (a - b))

ans = gcd(g, int(s))

print(ans)

0