結果

問題 No.751 Frac #2
ユーザー Yamada
提出日時 2018-12-28 00:21:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-01 14:56:47
合計ジャッジ時間 1,864 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

def euclid(n,m):
    if n > m:
        a = n
        b = m
    else:
        a = m
        b = n

    while b != 0:
        a = a % b
        a , b = b , a
    return a

n1 =int(input())
list1 =list(map(int,input().split()))
n2 =int(input())
list2 =list(map(int,input().split()))
nume =list1[0]
deno =list2[0]
for i in range(n1-1):
    deno *= list1[i+1]
for i in range(n2-1):
    nume *= list2[i+1]

gcd = euclid(nume,deno)
if deno < 0:
    nume *= -1
    deno *= -1
print(nume//gcd,deno//gcd)
0