結果
問題 | No.751 Frac #2 |
ユーザー |
|
提出日時 | 2022-04-05 23:23:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 353 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 82,124 KB |
実行使用メモリ | 54,480 KB |
最終ジャッジ日時 | 2024-11-27 08:21:57 |
合計ジャッジ時間 | 2,895 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 WA * 29 |
ソースコード
import math N1 = int(input()) lsA = list(map(int,input().split())) N2 = int(input()) lsB = list(map(int,input().split())) lsc = lsA[0]*lsB[-1] lsp = 1 for i in range(1,N1): lsp *= lsA[i] for i in range(N2-2,-1,-1): lsp *= lsB[i] gcd = math.gcd(lsc, lsp) if lsc*lsp < 0: print(-abs(lsc//gcd),abs(lsp//gcd)) else: print(lsc//gcd,lsp//gcd)