結果

問題 No.751 Frac #2
コンテスト
ユーザー yuppe19 😺
提出日時 2018-11-09 23:29:06
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 193 ms / 1,000 ms
コード長 382 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 154 ms
コンパイル使用メモリ 77,368 KB
最終ジャッジ日時 2025-12-04 01:26:33
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
from operator import mul
from fractions import Fraction as frac

n = int(raw_input())
a = map(int, raw_input().split())
m = int(raw_input())
b = map(int, raw_input().split())
nume = [a[0]] + b[1::2]
deno = a[1:]  + b[0::2]
nume = reduce(mul, nume)
deno = reduce(mul, deno)
res = frac(nume, deno)
print res.numerator, res.denominator
0