結果
問題 | No.751 Frac #2 |
ユーザー |
![]() |
提出日時 | 2018-11-09 22:42:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 1,000 ms |
コード長 | 353 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-11-21 06:32:01 |
合計ジャッジ時間 | 2,407 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
# -*- coding: utf-8 -*- import operator from functools import reduce from math import gcd def inpl(): return list(map(int, input().split())) n1 = int(input()) A = inpl() n2 = int(input()) B = inpl() X = reduce(operator.mul, [A[0]] + B[1::2]) Y = reduce(operator.mul, A[1:] + B[::2]) Z = gcd(X, Y) if Y < 0: X *= -1 Y *= -1 print(X//Z, Y//Z)