結果
問題 | No.751 Frac #2 |
ユーザー |
![]() |
提出日時 | 2022-11-19 01:21:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-09-20 05:26:23 |
合計ジャッジ時間 | 2,898 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 4 WA * 32 |
ソースコード
from fractions import Fraction from functools import reduce from operator import mul def main(): n1 = int(input()) a = list(map(int, input().split())) n2 = int(input()) b = list(map(int, input().split())) b = sorted(b, reverse=True) x = Fraction(a[0], reduce(mul, a[1:])) if n1 > 1 else 1 y = Fraction(b[0], reduce(mul, b[1:])) if n2 > 1 else 1 ans = Fraction(x * y) print(ans.numerator, ans.denominator) if __name__ == "__main__": main()