結果

問題 No.751 Frac #2
ユーザー c-yan
提出日時 2020-12-07 01:04:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-09-17 13:31:09
合計ジャッジ時間 2,463 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 24 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce
from math import gcd

n1 = int(input())
A = list(map(int, input().split()))
n2 = int(input())
B = list(map(int, input().split()))

a = A[0] * reduce(lambda x, y: x * y, B[1:])
b = B[0] * reduce(lambda x, y: x * y, A[1:])
t = gcd(a, b)
a, b = a // t, b // t
if b < 0:
    a, b = -a, -b
print(a, b)
0