結果
| 問題 |
No.751 Frac #2
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2018-11-09 21:44:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 546 bytes |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2024-11-21 05:47:28 |
| 合計ジャッジ時間 | 2,323 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 29 |
ソースコード
import fractions
import functools
def main():
_ = input()
xs = [fractions.Fraction(int(x), 1) for x in input().split()]
f = functools.reduce(lambda f1, f2: f1 / f2, xs)
# print(f)
_ = input()
ys = [fractions.Fraction(int(x), 1) for x in input().split()][::-1]
g = 1 / functools.reduce(lambda f1, f2: f1 / f2, ys)
# print(g)
res = f / g
if res.denominator >= 0:
print(res.numerator, res.denominator)
else:
print(-res.numerator, -res.denominator)
if __name__ == '__main__':
main()
はむ吉🐹