結果

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

ソースコード

diff #

from fractions import Fraction as fra

na=int(input())
la=list(map(int,input().split()))
nb=int(input())
lb=list(map(int,input().split()))

if na == 1:
    a=fra(la[0],1)
else:
    a=fra(la[0],la[1])
    for i in range(2,na):
        a=a*fra(1,la[i])
if nb == 1:
    b=fra(lb[0])
else:
    b=fra(lb[0],lb[1])
    for i in range(2,nb):
        b=b*fra(1,lb[i])
ans=a/b

print(ans.numerator, ans.denominator)



0