結果

問題 No.443 GCD of Permutation
ユーザー ebicochinealebicochineal
提出日時 2016-11-12 00:02:14
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 652 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 85,720 KB
最終ジャッジ日時 2023-08-16 20:26:25
合計ジャッジ時間 4,566 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
82,484 KB
testcase_01 AC 70 ms
71,412 KB
testcase_02 AC 67 ms
71,472 KB
testcase_03 AC 72 ms
75,364 KB
testcase_04 AC 103 ms
77,056 KB
testcase_05 AC 69 ms
71,436 KB
testcase_06 AC 68 ms
71,392 KB
testcase_07 AC 73 ms
76,060 KB
testcase_08 AC 70 ms
71,416 KB
testcase_09 AC 70 ms
75,360 KB
testcase_10 AC 69 ms
71,292 KB
testcase_11 AC 71 ms
75,280 KB
testcase_12 AC 69 ms
71,424 KB
testcase_13 AC 68 ms
71,492 KB
testcase_14 RE -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def f(n):
    l = []
    a, b = 0, 2
    while b * b <= n:
        if n % b == 0:
            n //= b
            l += [b]
        else:
            b += 1 + a
            a = 1
    if n > 1 : l += [n]
    return [1] + l

def g(a, b):
    r = []
    for i in a:
        if b % i == 0:
            r += [i]
            b //= i
    return r

def main():
    l = input()
    s = set([])
    a = 0
    for i in itertools.permutations(l, len(l)):
        a = int(''.join(i))
        s.add(a)
    a = f(a)
    for i in s:
        a = g(a, i)
    ans = 1
    for i in a:
        ans *= i
    print(ans)

if __name__ == '__main__':
    main()
0