結果
問題 | No.443 GCD of Permutation |
ユーザー |
![]() |
提出日時 | 2023-04-25 14:05:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 43 ms / 1,000 ms |
コード長 | 344 bytes |
コンパイル時間 | 427 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-11-14 09:57:36 |
合計ジャッジ時間 | 2,746 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
import sys sys.set_int_max_str_digits(10005) def gcd(a,b): while b:a,b=b,a%b return a def main(): s=input() num=set() for c in s: c=int(c) num.add(c) g=0 for a in num: for b in num: if g:g=gcd(g,9*abs(a-b)) else:g=9*abs(a-b) g=gcd(g,int(s)) print(g) main()