結果

問題 No.751 Frac #2
ユーザー rlangevinrlangevin
提出日時 2023-01-15 13:26:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 71,740 KB
最終ジャッジ日時 2023-08-27 21:02:10
合計ジャッジ時間 5,447 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,452 KB
testcase_01 AC 76 ms
71,256 KB
testcase_02 AC 78 ms
71,452 KB
testcase_03 AC 78 ms
71,692 KB
testcase_04 AC 79 ms
71,624 KB
testcase_05 AC 76 ms
71,696 KB
testcase_06 AC 77 ms
71,444 KB
testcase_07 AC 76 ms
71,396 KB
testcase_08 AC 77 ms
71,512 KB
testcase_09 AC 76 ms
71,428 KB
testcase_10 AC 77 ms
71,216 KB
testcase_11 AC 76 ms
71,208 KB
testcase_12 AC 76 ms
71,204 KB
testcase_13 AC 76 ms
71,368 KB
testcase_14 AC 74 ms
71,332 KB
testcase_15 AC 75 ms
71,508 KB
testcase_16 AC 76 ms
71,432 KB
testcase_17 AC 76 ms
71,696 KB
testcase_18 AC 76 ms
71,620 KB
testcase_19 AC 76 ms
71,452 KB
testcase_20 AC 76 ms
71,452 KB
testcase_21 AC 74 ms
71,456 KB
testcase_22 AC 75 ms
71,408 KB
testcase_23 AC 75 ms
71,208 KB
testcase_24 AC 76 ms
71,344 KB
testcase_25 AC 80 ms
71,392 KB
testcase_26 AC 77 ms
71,372 KB
testcase_27 AC 76 ms
71,740 KB
testcase_28 AC 76 ms
71,660 KB
testcase_29 AC 77 ms
71,688 KB
testcase_30 AC 77 ms
71,380 KB
testcase_31 AC 76 ms
71,424 KB
testcase_32 AC 78 ms
71,512 KB
testcase_33 AC 77 ms
71,704 KB
testcase_34 AC 76 ms
71,260 KB
testcase_35 AC 75 ms
71,376 KB
testcase_36 AC 77 ms
71,656 KB
testcase_37 AC 75 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *

N1 = int(input())
A = list(map(int, input().split()))
N2 = int(input())
B = list(map(int, input().split()))
X, Y = 1, 1
for i, a in enumerate(A):
    if i == 0:
        X *= a
    else:
        Y *= a
            
for i, b in enumerate(B):
    if i % 2:
        X *= b
    else:
        Y *= b
        
g = gcd(X, Y)
X //= g
Y //= g
if X * Y < 0:
    print(-abs(X), abs(Y))
else:
    print(abs(X), abs(Y))
0