結果
問題 |
No.443 GCD of Permutation
|
ユーザー |
|
提出日時 | 2023-06-30 08:13:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 174 ms / 1,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-07-06 21:19:37 |
合計ジャッジ時間 | 2,343 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
import sys import itertools from math import gcd sys.set_int_max_str_digits(10 ** 6) def solve(N): Nt = tuple(int(x) for x in N) st = set(Nt) if len(st) == 1: return N g = gcd(*[9 * abs(x - y) for x, y in itertools.combinations(st, 2)]) return gcd(int(N), g) print(solve(input()))