結果
| 問題 | 
                            No.751 Frac #2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-01-18 19:48:17 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 46 ms / 1,000 ms | 
| コード長 | 231 bytes | 
| コンパイル時間 | 224 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 52,352 KB | 
| 最終ジャッジ日時 | 2024-11-23 13:28:29 | 
| 合計ジャッジ時間 | 2,796 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 36 | 
ソースコード
import math
input()
*a, = map(int, input().split())
input()
*b, = map(int, input().split())
x = y = 1
for i in a[1:]+b[::2]:
    y *= i
for i in a[:1]+b[1::2]:
    x*= i
if y<0:
    y*=-1;x*=-1
t = math.gcd(x, y)
print(x//t, y//t)