結果

問題 No.443 GCD of Permutation
ユーザー nebukuro09nebukuro09
提出日時 2016-11-11 23:12:46
言語 PyPy2
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 303 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 77,680 KB
実行使用メモリ 112,872 KB
最終ジャッジ日時 2023-08-17 03:17:10
合計ジャッジ時間 17,445 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 247 ms
109,184 KB
testcase_01 AC 239 ms
108,844 KB
testcase_02 AC 250 ms
109,488 KB
testcase_03 AC 249 ms
109,664 KB
testcase_04 AC 238 ms
109,132 KB
testcase_05 AC 232 ms
109,156 KB
testcase_06 AC 244 ms
109,048 KB
testcase_07 AC 249 ms
109,380 KB
testcase_08 AC 250 ms
109,468 KB
testcase_09 AC 247 ms
109,320 KB
testcase_10 AC 237 ms
109,380 KB
testcase_11 AC 250 ms
109,456 KB
testcase_12 AC 251 ms
109,320 KB
testcase_13 AC 238 ms
109,284 KB
testcase_14 AC 237 ms
109,260 KB
testcase_15 AC 454 ms
111,088 KB
testcase_16 AC 242 ms
109,468 KB
testcase_17 AC 350 ms
111,112 KB
testcase_18 AC 308 ms
110,928 KB
testcase_19 AC 246 ms
109,568 KB
testcase_20 AC 300 ms
111,048 KB
testcase_21 AC 455 ms
111,188 KB
testcase_22 AC 256 ms
109,324 KB
testcase_23 AC 254 ms
109,300 KB
testcase_24 AC 254 ms
109,576 KB
testcase_25 TLE -
testcase_26 TLE -
testcase_27 AC 577 ms
110,984 KB
testcase_28 AC 241 ms
109,292 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
from fractions import gcd

N = raw_input()
if all(d==N[0] for d in N):
    print N
    exit()

ans = gcd(int(N), int(N[::-1]))
N = list(N)

for i in xrange(10**3):
    random.shuffle(N)
    ans = gcd(ans, int(''.join(map(str,N))))
    if ans == 1:
        print 1
        exit()
print ans
0