結果

問題 No.751 Frac #2
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-18 19:48:17
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 79 ms / 1,000 ms
コード長 231 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 71,396 KB
最終ジャッジ日時 2023-08-15 07:36:52
合計ジャッジ時間 4,682 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,204 KB
testcase_01 AC 74 ms
70,856 KB
testcase_02 AC 76 ms
71,144 KB
testcase_03 AC 74 ms
71,396 KB
testcase_04 AC 76 ms
71,200 KB
testcase_05 AC 73 ms
70,932 KB
testcase_06 AC 74 ms
70,820 KB
testcase_07 AC 73 ms
71,240 KB
testcase_08 AC 73 ms
71,208 KB
testcase_09 AC 72 ms
70,976 KB
testcase_10 AC 75 ms
71,232 KB
testcase_11 AC 77 ms
71,100 KB
testcase_12 AC 74 ms
71,124 KB
testcase_13 AC 74 ms
71,260 KB
testcase_14 AC 75 ms
70,984 KB
testcase_15 AC 74 ms
70,860 KB
testcase_16 AC 76 ms
71,380 KB
testcase_17 AC 71 ms
70,844 KB
testcase_18 AC 74 ms
71,244 KB
testcase_19 AC 75 ms
71,304 KB
testcase_20 AC 74 ms
70,860 KB
testcase_21 AC 74 ms
71,152 KB
testcase_22 AC 75 ms
71,368 KB
testcase_23 AC 76 ms
71,120 KB
testcase_24 AC 75 ms
71,124 KB
testcase_25 AC 74 ms
70,992 KB
testcase_26 AC 75 ms
71,068 KB
testcase_27 AC 75 ms
71,380 KB
testcase_28 AC 75 ms
71,060 KB
testcase_29 AC 75 ms
71,124 KB
testcase_30 AC 78 ms
71,100 KB
testcase_31 AC 78 ms
70,992 KB
testcase_32 AC 74 ms
71,372 KB
testcase_33 AC 77 ms
70,716 KB
testcase_34 AC 74 ms
71,124 KB
testcase_35 AC 74 ms
70,724 KB
testcase_36 AC 76 ms
71,060 KB
testcase_37 AC 75 ms
71,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

input()
*a, = map(int, input().split())
input()
*b, = map(int, input().split())
x = y = 1
for i in a[1:]+b[::2]:
    y *= i
for i in a[:1]+b[1::2]:
    x*= i
if y<0:
    y*=-1;x*=-1
t = math.gcd(x, y)
print(x//t, y//t)
0