結果
問題 | No.751 Frac #2 |
ユーザー |
![]() |
提出日時 | 2020-12-23 11:23:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 1,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 82,096 KB |
実行使用メモリ | 52,736 KB |
最終ジャッジ日時 | 2024-09-21 16:20:35 |
合計ジャッジ時間 | 2,811 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
import math alen = int(input()) A = list(map(int,input().split())) blen = int(input()) B = list(map(int,input().split())) C = [] P = [] sig = 1 for i in range(alen): if i==0: C.append(A[i]) else: P.append(A[i]) sig*=A[i] for i in range(blen): if i%2==1: C.append(B[i]) else: P.append(B[i]) sig*=B[i] sig = sig//abs(sig) c = 1 p = 1 for i in C: c *= i for i in P: p *= i gcd = math.gcd(abs(c),abs(p)) print(sig*abs(c)//gcd,abs(p)//gcd)