結果

問題 No.443 GCD of Permutation
コンテスト
ユーザー nebukuro09
提出日時 2016-11-11 23:12:46
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 303 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,697 ms
コンパイル使用メモリ 80,056 KB
実行使用メモリ 105,324 KB
最終ジャッジ日時 2026-05-20 10:36:58
合計ジャッジ時間 11,664 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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