結果

問題 No.751 Frac #2
ユーザー NoaSaberNoaSaber
提出日時 2021-04-03 18:38:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 1,000 ms
コード長 389 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 71,292 KB
最終ジャッジ日時 2023-08-26 14:05:37
合計ジャッジ時間 4,668 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,208 KB
testcase_01 AC 62 ms
71,188 KB
testcase_02 AC 63 ms
70,792 KB
testcase_03 AC 64 ms
71,180 KB
testcase_04 AC 64 ms
71,212 KB
testcase_05 AC 63 ms
71,168 KB
testcase_06 AC 67 ms
71,208 KB
testcase_07 AC 65 ms
71,220 KB
testcase_08 AC 66 ms
71,124 KB
testcase_09 AC 65 ms
71,180 KB
testcase_10 AC 63 ms
71,188 KB
testcase_11 AC 63 ms
71,180 KB
testcase_12 AC 61 ms
71,192 KB
testcase_13 AC 65 ms
71,292 KB
testcase_14 AC 65 ms
71,128 KB
testcase_15 AC 65 ms
71,124 KB
testcase_16 AC 66 ms
70,924 KB
testcase_17 AC 66 ms
71,132 KB
testcase_18 AC 68 ms
71,184 KB
testcase_19 AC 65 ms
71,252 KB
testcase_20 AC 64 ms
71,008 KB
testcase_21 AC 67 ms
71,188 KB
testcase_22 AC 66 ms
71,176 KB
testcase_23 AC 65 ms
71,024 KB
testcase_24 AC 64 ms
70,820 KB
testcase_25 AC 65 ms
71,180 KB
testcase_26 AC 64 ms
71,088 KB
testcase_27 AC 63 ms
71,008 KB
testcase_28 AC 65 ms
70,952 KB
testcase_29 AC 66 ms
70,924 KB
testcase_30 AC 65 ms
71,008 KB
testcase_31 AC 66 ms
71,260 KB
testcase_32 AC 66 ms
70,796 KB
testcase_33 AC 67 ms
71,288 KB
testcase_34 AC 68 ms
70,796 KB
testcase_35 AC 66 ms
70,956 KB
testcase_36 AC 66 ms
71,168 KB
testcase_37 AC 65 ms
71,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n_1=int(input())
A=list(map(int,input().split()))
n_2=int(input())
B=list(map(int,input().split()))
up,down=A[0],1
A=A[1:]
import math
for i in A:
    down*=i
for i,j in enumerate(B):
    if i%2==0:
        down*=j
    else:
        up*=j
minus=0
if down<0:minus+=1;down=abs(down)
if up<0:minus+=1;up=abs(up)
s=-1 if minus%2==1 else 1
print(s*up//math.gcd(up,down),down//math.gcd(up,down))
0