結果

問題 No.751 Frac #2
ユーザー KTR216
提出日時 2018-11-09 22:17:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 342 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-21 06:09:25
合計ジャッジ時間 2,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

n1 = int(input())
a = list(map(int, input().split()))
n2 = int(input())
b = list(map(int, input().split()))
bunbo = b[0]
bunsi = a[0]
for i in a[1:]:
    bunbo = bunbo * i
for i in b[1:]:
    bunsi = bunsi * i
g = gcd(bunsi, bunbo)
print(int(bunsi / g), int(bunbo / g))
0