結果

問題 No.751 Frac #2
ユーザー 👑 KazunKazun
提出日時 2020-10-14 04:10:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 65 ms / 1,000 ms
コード長 357 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 71,752 KB
最終ジャッジ日時 2023-09-28 00:27:47
合計ジャッジ時間 5,491 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,240 KB
testcase_01 AC 64 ms
71,440 KB
testcase_02 AC 63 ms
71,360 KB
testcase_03 AC 63 ms
71,476 KB
testcase_04 AC 61 ms
71,400 KB
testcase_05 AC 61 ms
71,084 KB
testcase_06 AC 62 ms
71,316 KB
testcase_07 AC 64 ms
71,248 KB
testcase_08 AC 64 ms
71,248 KB
testcase_09 AC 63 ms
71,292 KB
testcase_10 AC 61 ms
71,248 KB
testcase_11 AC 63 ms
71,752 KB
testcase_12 AC 65 ms
71,324 KB
testcase_13 AC 65 ms
71,408 KB
testcase_14 AC 63 ms
71,368 KB
testcase_15 AC 64 ms
71,652 KB
testcase_16 AC 62 ms
71,636 KB
testcase_17 AC 61 ms
71,408 KB
testcase_18 AC 63 ms
71,660 KB
testcase_19 AC 63 ms
71,140 KB
testcase_20 AC 63 ms
71,188 KB
testcase_21 AC 62 ms
71,452 KB
testcase_22 AC 64 ms
71,652 KB
testcase_23 AC 64 ms
71,676 KB
testcase_24 AC 63 ms
71,604 KB
testcase_25 AC 61 ms
71,216 KB
testcase_26 AC 62 ms
71,372 KB
testcase_27 AC 63 ms
71,400 KB
testcase_28 AC 62 ms
71,488 KB
testcase_29 AC 60 ms
71,724 KB
testcase_30 AC 62 ms
71,596 KB
testcase_31 AC 61 ms
71,196 KB
testcase_32 AC 62 ms
71,200 KB
testcase_33 AC 63 ms
71,652 KB
testcase_34 AC 63 ms
71,408 KB
testcase_35 AC 62 ms
71,328 KB
testcase_36 AC 61 ms
71,316 KB
testcase_37 AC 62 ms
71,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

N=int(input())
A=list(map(int,input().split()))
M=int(input())
B=list(map(int,input().split()))

s=A[0]
t=1
for a in A[1:]:
    t*=a

u=1
v=1
for i in range(M):
    if i%2==0:
        u*=B[i]
    else:
        v*=B[i]

alpha=s*v
beta=t*u

g=gcd(alpha,beta)
alpha//=g
beta //=g

if beta<0:
    alpha*=-1
    beta *=-1

print(alpha,beta)
0