結果

問題 No.443 GCD of Permutation
ユーザー tktk_snsntktk_snsn
提出日時 2020-11-29 22:14:21
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 393 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 78,620 KB
最終ジャッジ日時 2023-10-11 02:38:45
合計ジャッジ時間 5,617 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,668 KB
testcase_01 AC 95 ms
71,700 KB
testcase_02 AC 93 ms
71,516 KB
testcase_03 AC 94 ms
71,508 KB
testcase_04 AC 92 ms
71,656 KB
testcase_05 AC 93 ms
72,048 KB
testcase_06 AC 94 ms
71,660 KB
testcase_07 AC 91 ms
71,820 KB
testcase_08 AC 93 ms
71,660 KB
testcase_09 AC 90 ms
72,040 KB
testcase_10 AC 90 ms
72,036 KB
testcase_11 AC 89 ms
71,960 KB
testcase_12 AC 90 ms
72,004 KB
testcase_13 AC 90 ms
71,660 KB
testcase_14 AC 95 ms
76,860 KB
testcase_15 AC 95 ms
76,932 KB
testcase_16 AC 95 ms
76,932 KB
testcase_17 AC 96 ms
76,928 KB
testcase_18 RE -
testcase_19 AC 96 ms
77,168 KB
testcase_20 RE -
testcase_21 AC 96 ms
77,264 KB
testcase_22 AC 90 ms
72,100 KB
testcase_23 AC 89 ms
71,856 KB
testcase_24 AC 90 ms
71,528 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from itertools import permutations
from math import gcd


def main():
    S = input()
    C = Counter(S)

    if len(C) == 1:
        return S

    keys = C.keys()
    res = int(S)
    for a in keys:
        a = int(a)
        for b in keys:
            b = int(b)
            if a > b:
                res = gcd(res, 9 * (a - b))
    return res


print(main())
0