結果
| 問題 |
No.751 Frac #2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-03 18:38:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 1,000 ms |
| コード長 | 389 bytes |
| コンパイル時間 | 267 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2024-12-25 11:21:46 |
| 合計ジャッジ時間 | 3,333 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
n_1=int(input())
A=list(map(int,input().split()))
n_2=int(input())
B=list(map(int,input().split()))
up,down=A[0],1
A=A[1:]
import math
for i in A:
down*=i
for i,j in enumerate(B):
if i%2==0:
down*=j
else:
up*=j
minus=0
if down<0:minus+=1;down=abs(down)
if up<0:minus+=1;up=abs(up)
s=-1 if minus%2==1 else 1
print(s*up//math.gcd(up,down),down//math.gcd(up,down))