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