結果

問題 No.751 Frac #2
ユーザー nebukuro09nebukuro09
提出日時 2018-11-09 21:26:57
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-11-21 05:33:07
合計ジャッジ時間 2,435 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction as F
N = input()
A = map(int, raw_input().split())
M = input()
B = map(int, raw_input().split())
B.reverse()
X = A[0]
for i in xrange(1, N):
    X /= F(A[i])
Y = B[0]
for i in xrange(1, M):
    Y = F(B[i]) / Y
Z = X / Y
if Z < 0:
    Z = abs(Z)
    print -Z.numerator, Z.denominator
else:
    print Z.numerator, Z.denominator
0