結果

問題 No.751 Frac #2
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-17 19:51:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 86,664 KB
実行使用メモリ 71,680 KB
最終ジャッジ日時 2023-10-12 23:05:18
合計ジャッジ時間 5,588 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,352 KB
testcase_01 AC 75 ms
71,388 KB
testcase_02 WA -
testcase_03 AC 71 ms
71,316 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 73 ms
71,152 KB
testcase_09 AC 72 ms
71,156 KB
testcase_10 WA -
testcase_11 AC 72 ms
71,240 KB
testcase_12 AC 73 ms
71,344 KB
testcase_13 AC 73 ms
71,460 KB
testcase_14 AC 72 ms
71,208 KB
testcase_15 AC 70 ms
71,356 KB
testcase_16 AC 72 ms
71,500 KB
testcase_17 AC 76 ms
71,132 KB
testcase_18 AC 74 ms
71,416 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 71 ms
71,560 KB
testcase_22 WA -
testcase_23 AC 72 ms
71,248 KB
testcase_24 AC 72 ms
71,572 KB
testcase_25 AC 71 ms
71,156 KB
testcase_26 AC 73 ms
71,572 KB
testcase_27 AC 74 ms
71,060 KB
testcase_28 WA -
testcase_29 AC 74 ms
71,264 KB
testcase_30 AC 70 ms
71,324 KB
testcase_31 AC 72 ms
71,008 KB
testcase_32 AC 71 ms
71,276 KB
testcase_33 AC 73 ms
71,272 KB
testcase_34 AC 70 ms
71,580 KB
testcase_35 AC 73 ms
71,156 KB
testcase_36 AC 75 ms
71,160 KB
testcase_37 AC 70 ms
71,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n1 = int(input())
A = list(map(int, input().split()))
n2 = int(input())
B = list(map(int, input().split()))

x = A[0]
y = 1

for i in range(1, n1):
    y *= A[i]

for i in range(n2):
    if i%2 == 0:
        y *= B[i]
    else:
        x *= B[i]

import math
if x*y > 0:
    g = math.gcd(x, y)
    a, b = x//g, y//g
else:
    g = math.gcd(abs(x), abs(y))
    a, b = -abs(x)//g, abs(y)//g
print(a, b)
0