結果
| 問題 | No.443 GCD of Permutation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-12 19:32:50 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 152 ms / 1,000 ms |
| + 194µs | |
| コード長 | 297 bytes |
| 記録 | |
| コンパイル時間 | 65 ms |
| コンパイル使用メモリ | 80,768 KB |
| 実行使用メモリ | 101,008 KB |
| 最終ジャッジ日時 | 2026-07-18 10:57:16 |
| 合計ジャッジ時間 | 6,246 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
from itertools import product
from fractions import gcd
g = input()
digits = sorted(map(eval, str(g)))
if len(set(digits)) == 1:
print g
else:
digit_len = len(str(g))
digits = list(set(digits))
G = g
for x in product(digits, repeat=2):
G = abs(gcd(G, 9 * (x[0] - x[1])))
print G