結果

問題 No.443 GCD of Permutation
ユーザー titiatitia
提出日時 2023-05-11 00:38:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 329 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-08-18 01:50:46
合計ジャッジ時間 2,474 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,528 KB
testcase_01 AC 21 ms
8,584 KB
testcase_02 AC 19 ms
8,556 KB
testcase_03 AC 19 ms
8,524 KB
testcase_04 AC 19 ms
8,528 KB
testcase_05 AC 19 ms
8,576 KB
testcase_06 AC 18 ms
8,740 KB
testcase_07 AC 19 ms
8,668 KB
testcase_08 AC 19 ms
8,648 KB
testcase_09 AC 19 ms
8,524 KB
testcase_10 AC 19 ms
8,556 KB
testcase_11 AC 18 ms
8,532 KB
testcase_12 AC 19 ms
8,584 KB
testcase_13 AC 18 ms
8,576 KB
testcase_14 RE -
testcase_15 AC 19 ms
8,688 KB
testcase_16 AC 19 ms
8,552 KB
testcase_17 AC 19 ms
8,520 KB
testcase_18 RE -
testcase_19 AC 19 ms
8,528 KB
testcase_20 RE -
testcase_21 AC 19 ms
8,576 KB
testcase_22 AC 18 ms
8,520 KB
testcase_23 AC 19 ms
8,712 KB
testcase_24 AC 19 ms
8,644 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
from collections import Counter

S=input()
C=Counter(S)

ANS=int(S)

for i in range(10):
    for j in range(i+1,10):
        if C[str(i)]>0 and C[str(j)]>0:
            if "i"==0:
                ANS=gcd(ANS,j)

            else:
                a=(10*j+i)-(10*i+j)
                ANS=gcd(ANS,a)

print(ANS)
0