結果
問題 | No.751 Frac #2 |
ユーザー |
|
提出日時 | 2022-01-18 19:40:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 390 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 52,608 KB |
最終ジャッジ日時 | 2024-11-23 13:28:09 |
合計ジャッジ時間 | 2,828 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 WA * 18 |
ソースコード
from math import gcd n_1=int(input()) a=list(map(int,input().split())) n_2=int(input()) b=list(map(int,input().split())) a_up=a_down=b_up=b_down=1 for i in range(n_1): if i==0: a_up*=a[i] else: a_down*=a[i] for i in range(n_2): if i%2==0: b_up*=b[i] else: b_down*=b[i] ans1=a_up*b_down ans2=a_down*b_up d=gcd(ans1,ans2) print(ans1//d,ans2//d)