結果

問題 No.443 GCD of Permutation
ユーザー nebukuro09nebukuro09
提出日時 2016-11-11 23:12:46
言語 PyPy2
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 303 bytes
コンパイル時間 1,083 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 108,320 KB
最終ジャッジ日時 2024-05-04 10:30:28
合計ジャッジ時間 12,056 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 223 ms
107,392 KB
testcase_01 AC 211 ms
106,880 KB
testcase_02 AC 215 ms
107,008 KB
testcase_03 AC 217 ms
107,264 KB
testcase_04 AC 206 ms
107,264 KB
testcase_05 AC 204 ms
107,264 KB
testcase_06 AC 219 ms
107,176 KB
testcase_07 AC 220 ms
107,424 KB
testcase_08 AC 213 ms
107,392 KB
testcase_09 AC 216 ms
107,392 KB
testcase_10 AC 196 ms
107,164 KB
testcase_11 AC 213 ms
107,392 KB
testcase_12 AC 221 ms
107,300 KB
testcase_13 AC 212 ms
106,880 KB
testcase_14 AC 206 ms
107,008 KB
testcase_15 AC 407 ms
107,520 KB
testcase_16 AC 208 ms
107,776 KB
testcase_17 AC 302 ms
107,680 KB
testcase_18 AC 265 ms
107,552 KB
testcase_19 AC 205 ms
107,544 KB
testcase_20 AC 261 ms
107,648 KB
testcase_21 AC 412 ms
107,648 KB
testcase_22 AC 222 ms
107,284 KB
testcase_23 AC 211 ms
107,648 KB
testcase_24 AC 210 ms
107,012 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 461 ms
107,776 KB
testcase_28 AC 198 ms
107,264 KB
testcase_29 AC 816 ms
107,776 KB
testcase_30 AC 860 ms
108,288 KB
testcase_31 AC 904 ms
108,320 KB
権限があれば一括ダウンロードができます

ソースコード

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