結果

問題 No.443 GCD of Permutation
ユーザー nebukuro09
提出日時 2016-11-11 23:12:32
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 303 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 76,724 KB
実行使用メモリ 217,400 KB
最終ジャッジ日時 2024-11-25 09:27:04
合計ジャッジ時間 24,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

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**4):
    random.shuffle(N)
    ans = gcd(ans, int(''.join(map(str,N))))
    if ans == 1:
        print 1
        exit()
print ans
0