結果

問題 No.751 Frac #2
ユーザー kohei2019kohei2019
提出日時 2022-04-05 23:27:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 1,000 ms
コード長 457 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 71,764 KB
最終ジャッジ日時 2023-08-18 05:29:48
合計ジャッジ時間 4,811 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,324 KB
testcase_01 AC 78 ms
71,364 KB
testcase_02 AC 80 ms
71,548 KB
testcase_03 AC 78 ms
71,220 KB
testcase_04 AC 78 ms
71,232 KB
testcase_05 AC 77 ms
71,652 KB
testcase_06 AC 80 ms
71,492 KB
testcase_07 AC 77 ms
71,484 KB
testcase_08 AC 77 ms
71,720 KB
testcase_09 AC 77 ms
71,352 KB
testcase_10 AC 79 ms
71,424 KB
testcase_11 AC 80 ms
71,464 KB
testcase_12 AC 80 ms
71,300 KB
testcase_13 AC 79 ms
71,232 KB
testcase_14 AC 77 ms
71,520 KB
testcase_15 AC 77 ms
71,304 KB
testcase_16 AC 77 ms
71,428 KB
testcase_17 AC 80 ms
71,148 KB
testcase_18 AC 79 ms
71,532 KB
testcase_19 AC 77 ms
71,600 KB
testcase_20 AC 79 ms
71,656 KB
testcase_21 AC 79 ms
71,400 KB
testcase_22 AC 79 ms
71,376 KB
testcase_23 AC 77 ms
71,764 KB
testcase_24 AC 76 ms
71,584 KB
testcase_25 AC 77 ms
71,268 KB
testcase_26 AC 77 ms
71,352 KB
testcase_27 AC 78 ms
71,684 KB
testcase_28 AC 78 ms
71,548 KB
testcase_29 AC 79 ms
71,492 KB
testcase_30 AC 76 ms
71,320 KB
testcase_31 AC 77 ms
71,384 KB
testcase_32 AC 78 ms
71,312 KB
testcase_33 AC 78 ms
71,448 KB
testcase_34 AC 76 ms
71,436 KB
testcase_35 AC 75 ms
71,492 KB
testcase_36 AC 78 ms
71,436 KB
testcase_37 AC 78 ms
71,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N1 = int(input())
lsA = list(map(int,input().split()))
N2 = int(input())
lsB = list(map(int,input().split()))
lsc = lsA[0]
lsp = 1
for i in range(1,N1):
    lsp *= lsA[i]
for i in range(N2):
    if i % 2 == 0:
        lsp *= lsB[i]
    else:
        lsc *= lsB[i]
gcd = math.gcd(lsc, lsp)
if lsc*lsp < 0:
    print(-abs(lsc//gcd),abs(lsp//gcd))
elif lsc < 0 and lsp < 0:
    print(abs(lsc//gcd),abs(lsp//gcd))
else:
    print(lsc//gcd,lsp//gcd)
0