結果

問題 No.443 GCD of Permutation
コンテスト
ユーザー rin204
提出日時 2023-04-21 23:22:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 337 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 295 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 59,776 KB
最終ジャッジ日時 2026-05-06 21:25:18
合計ジャッジ時間 3,004 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys


sys.set_int_max_str_digits(10 ** 9)

from math import gcd

n = input()
cnt = [0] * 10
for s in n:
    cnt[int(s)] += 1
g = int(n)
for i in range(10):
    if cnt[i] == 0:
        continue
    for j in range(i + 1, 10):
        if cnt[j] == 0 or i == j:
            continue
        
        g = gcd(g, 9 * (j - i))
print(g)

0