結果
問題 | No.751 Frac #2 |
ユーザー |
![]() |
提出日時 | 2024-11-22 22:18:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 50 ms / 1,000 ms |
コード長 | 434 bytes |
コンパイル時間 | 448 ms |
コンパイル使用メモリ | 82,056 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-11-22 22:18:16 |
合計ジャッジ時間 | 4,027 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
N1 = int(input())A = list(map(int,input().split()))N2 = int(input())B = list(map(int,input().split()))daut = 1mot = 1for i in range(N1):if i == 0:daut *= A[i]else:mot *= A[i]for i in range(N2):if i % 2 == 0:mot *= B[i]else:daut *= B[i]a = 1if mot * daut < 0:a = -1mot = abs(mot)daut = abs(daut)from math import gcdx = gcd(mot,daut)print(daut//x * a,mot//x)