結果
| 問題 | 
                            No.751 Frac #2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Yamada
                         | 
                    
| 提出日時 | 2018-12-28 00:24:20 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 501 bytes | 
| コンパイル時間 | 77 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-10-01 14:56:54 | 
| 合計ジャッジ時間 | 1,919 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 9 WA * 27 | 
ソースコード
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 = abs(euclid(nume,deno))
if deno < 0:
    nume *= -1
    deno *= -1
print(nume//gcd,deno//gcd)
            
            
            
        
            
Yamada