結果

問題 No.751 Frac #2
ユーザー yuppe19 😺
提出日時 2020-08-11 18:54:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 1,000 ms
コード長 403 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-10-09 11:36:38
合計ジャッジ時間 2,575 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# †
from fractions import Fraction as frac
from functools import reduce

###
if __name__ == '__main__':
    input()
    a = list(map(int, input().split()))
    input()
    b = list(map(int, input().split()))
    nume = reduce(lambda x, y: frac(x, y), a)
    deno = reduce(lambda x, y: frac(y, x), reversed(b))
    res = frac(nume, deno)
    print(res.numerator, res.denominator)
0