結果

問題 No.751 Frac #2
ユーザー chocoruskchocorusk
提出日時 2018-11-10 08:35:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 455 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-05-02 01:08:07
合計ジャッジ時間 2,498 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 32 ms
10,752 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 31 ms
10,752 KB
testcase_13 AC 31 ms
10,752 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 31 ms
10,752 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 33 ms
10,752 KB
testcase_22 AC 33 ms
10,880 KB
testcase_23 AC 32 ms
10,752 KB
testcase_24 WA -
testcase_25 AC 31 ms
10,752 KB
testcase_26 AC 31 ms
10,880 KB
testcase_27 AC 32 ms
10,752 KB
testcase_28 AC 31 ms
10,752 KB
testcase_29 WA -
testcase_30 AC 32 ms
10,752 KB
testcase_31 AC 31 ms
10,752 KB
testcase_32 AC 32 ms
10,752 KB
testcase_33 AC 31 ms
10,752 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n1=int(input())
a=list(map(int, input().split()))
a1=a[0]
a2=1
p=a[0]//abs(a[0])
for i in range(1, n1):
    a2*=abs(a[i])
    p*=(a[i]//abs(a[i]))
n2=int(input())
b1=1
b2=1
b=list(map(int, input().split()))
for i in range(n2):
    if i%2:
        b2*=abs(b[i])
    else:
        b1*=abs(b[i])
    p*=(b[i]//abs(b[i]))
c1=a1*b2
c2=a2*b1
def gcd(x, y):
    if y==0:
        return x
    return gcd(y, x%y)
g=gcd(c1, c2)
print("{} {}".format(c1//g*p, c2//g))
0