結果
| 問題 | 
                            No.3020 ユークリッドの互除法・改
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-02-14 21:26:16 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 125 ms / 2,000 ms | 
| コード長 | 473 bytes | 
| コンパイル時間 | 331 ms | 
| コンパイル使用メモリ | 82,636 KB | 
| 実行使用メモリ | 86,576 KB | 
| 最終ジャッジ日時 | 2025-02-14 21:26:34 | 
| 合計ジャッジ時間 | 4,363 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#input = sys.stdin.readline
#sys.setrecursionlimit(10**9)
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
a,b = map(int,input().split())
c,d = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
if a == b == c == d == 0:
    print(0,0)
    exit()
d1 = math.gcd(a,b,c,d)
print(d1,abs(a*d - b*c)//d1)