結果

問題 No.751 Frac #2
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-17 19:55:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 410 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 71,616 KB
最終ジャッジ日時 2023-10-12 23:09:33
合計ジャッジ時間 5,764 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,556 KB
testcase_01 AC 73 ms
71,080 KB
testcase_02 AC 71 ms
71,056 KB
testcase_03 AC 73 ms
71,224 KB
testcase_04 AC 73 ms
71,416 KB
testcase_05 AC 75 ms
71,072 KB
testcase_06 AC 73 ms
71,072 KB
testcase_07 AC 76 ms
71,232 KB
testcase_08 AC 74 ms
71,072 KB
testcase_09 AC 73 ms
71,560 KB
testcase_10 AC 71 ms
71,208 KB
testcase_11 AC 72 ms
71,348 KB
testcase_12 AC 71 ms
71,408 KB
testcase_13 AC 70 ms
71,404 KB
testcase_14 AC 69 ms
71,300 KB
testcase_15 AC 71 ms
71,616 KB
testcase_16 AC 73 ms
71,348 KB
testcase_17 AC 76 ms
71,232 KB
testcase_18 AC 73 ms
71,548 KB
testcase_19 AC 72 ms
71,412 KB
testcase_20 AC 71 ms
71,612 KB
testcase_21 AC 72 ms
71,372 KB
testcase_22 AC 71 ms
71,256 KB
testcase_23 AC 71 ms
71,252 KB
testcase_24 AC 71 ms
71,288 KB
testcase_25 AC 70 ms
71,228 KB
testcase_26 AC 71 ms
71,400 KB
testcase_27 AC 71 ms
71,616 KB
testcase_28 AC 76 ms
71,456 KB
testcase_29 AC 71 ms
71,360 KB
testcase_30 AC 71 ms
71,284 KB
testcase_31 AC 73 ms
71,200 KB
testcase_32 AC 70 ms
71,544 KB
testcase_33 AC 71 ms
71,352 KB
testcase_34 AC 71 ms
71,464 KB
testcase_35 AC 72 ms
71,196 KB
testcase_36 AC 70 ms
71,068 KB
testcase_37 AC 73 ms
71,348 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 = abs(x)//g, abs(y)//g
else:
    g = math.gcd(abs(x), abs(y))
    a, b = -abs(x)//g, abs(y)//g
print(a, b)
0