結果

問題 No.3020 ユークリッドの互除法・改
コンテスト
ユーザー kidodesu
提出日時 2025-02-14 22:05:14
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 252 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 439 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 52,096 KB
最終ジャッジ日時 2026-07-01 08:11:26
合計ジャッジ時間 2,082 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

A = list(map(int, input().split()))
B = list(map(int, input().split()))
if A == [0, 0] == B:
    print(0, 0)
    exit()
ans = abs(A[0] * B[1] - A[1] * B[0])
from math import gcd
g = gcd(A[0], A[1])
g1 = gcd(B[0], B[1])
g = gcd(g, g1)
print(g, ans // g)
0