結果
| 問題 |
No.751 Frac #2
|
| コンテスト | |
| ユーザー |
hiragn
|
| 提出日時 | 2022-11-19 01:12:23 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 451 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,520 KB |
| 最終ジャッジ日時 | 2024-09-20 05:19:32 |
| 合計ジャッジ時間 | 3,390 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()))
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()
hiragn