結果
問題 | No.751 Frac #2 |
ユーザー |
👑 ![]() |
提出日時 | 2020-10-14 04:10:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 39 ms / 1,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 1,619 ms |
コンパイル使用メモリ | 82,264 KB |
実行使用メモリ | 52,608 KB |
最終ジャッジ日時 | 2024-07-20 18:58:29 |
合計ジャッジ時間 | 4,351 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
from math import gcdN=int(input())A=list(map(int,input().split()))M=int(input())B=list(map(int,input().split()))s=A[0]t=1for a in A[1:]:t*=au=1v=1for i in range(M):if i%2==0:u*=B[i]else:v*=B[i]alpha=s*vbeta=t*ug=gcd(alpha,beta)alpha//=gbeta //=gif beta<0:alpha*=-1beta *=-1print(alpha,beta)