結果

問題 No.443 GCD of Permutation
ユーザー kamomekamome
提出日時 2019-07-08 19:25:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 336 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-17 14:41:28
合計ジャッジ時間 3,860 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
16,256 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 32 ms
10,880 KB
testcase_10 AC 32 ms
10,752 KB
testcase_11 AC 32 ms
10,752 KB
testcase_12 AC 31 ms
10,752 KB
testcase_13 AC 31 ms
10,752 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 #

#!/usr/bin/python3
from math import gcd
import itertools
N_list= list(input())
gcd_total=None

for i in itertools.permutations(N_list):
    if not gcd_total:
        gcd_total = int("".join(i))
    elif gcd_total==1:
        print(1)
        exit()
    else:
        i=int("".join(i))
        gcd_total=gcd(i,gcd_total)
print(gcd_total)
0