結果

問題 No.443 GCD of Permutation
ユーザー kimiyuki
提出日時 2016-11-12 19:45:23
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 2,097 ms
コンパイル使用メモリ 76,672 KB
実行使用メモリ 108,672 KB
最終ジャッジ日時 2024-11-25 21:31:06
合計ジャッジ時間 33,789 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python2
import time
import random
import fractions
s = list(raw_input())
n = int(''.join(s))
d = n
while time.clock() < 0.9:
    i = random.randint(0, len(s)-1)
    j = random.randint(0, len(s)-1)
    n += (ord(s[j]) - ord(s[i])) * 10 ** (len(s)-1-i)
    n += (ord(s[i]) - ord(s[j])) * 10 ** (len(s)-1-j)
    s[i], s[j] = s[j], s[i]
    d = fractions.gcd(d, n)
print(d)
0