結果

問題 No.751 Frac #2
ユーザー convexineq
提出日時 2021-03-14 17:25:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 286 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 54,544 KB
最終ジャッジ日時 2024-11-06 07:03:59
合計ジャッジ時間 3,132 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
m = int(input())
*b, = map(int,input().split())

p = a[0]
q = 1
for i in a[1:]:
    q *= i
for i in b[m-1::-2]:
    p *= i
for i in b[m-2::-2]:
    q *= i
from math import gcd
g = gcd(p,q)
p //= g; q //= g
if q < 0: p,q = -p,-q
print(p,q)
0