結果
問題 | No.3020 ユークリッドの互除法・改 |
ユーザー |
![]() |
提出日時 | 2025-02-14 21:24:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 242 bytes |
コンパイル時間 | 372 ms |
コンパイル使用メモリ | 82,080 KB |
実行使用メモリ | 53,668 KB |
最終ジャッジ日時 | 2025-02-14 21:24:34 |
合計ジャッジ時間 | 2,142 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
import math a,b=map(int,input().split()) c,d=map(int,input().split()) det=abs(a*d-b*c) g=math.gcd(math.gcd(abs(a),abs(b)),math.gcd(abs(c),abs(d))) if det==0: if g==0: print(0,0) else: print(g,0) else: print(min(g,det//g),max(g,det//g))