結果

問題 No.442 和と積
ユーザー FGtatsuro
提出日時 2020-07-05 17:22:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 1,000 ms
コード長 347 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 53,668 KB
最終ジャッジ日時 2024-09-22 15:02:28
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

a, b = map(int, input().split())

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

# A = gA'/B = gB' の変換がポイント(A', B' は互いに素になる=共通の素因数を持たない)
g = gcd(a, b)
print(g * gcd((a + b) // g, g))
0