結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-11 23:12:17 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 303 bytes |
| コンパイル時間 | 1,683 ms |
| コンパイル使用メモリ | 76,704 KB |
| 実行使用メモリ | 217,020 KB |
| 最終ジャッジ日時 | 2024-11-25 09:26:29 |
| 合計ジャッジ時間 | 28,093 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 TLE * 9 |
ソースコード
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**5):
random.shuffle(N)
ans = gcd(ans, int(''.join(map(str,N))))
if ans == 1:
print 1
exit()
print ans