結果

問題 No.1931 Fraction 2
ユーザー ytqm3
提出日時 2022-04-27 23:25:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 266 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 85,888 KB
最終ジャッジ日時 2024-07-06 17:16:33
合計ジャッジ時間 5,601 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 1 -- * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
	A[i], B[i] = map(int,input().split())
c, d = 0, 1
for i in range(N):
	e, f = c * B[i] + d * A[i], d * B[i]
	g = math.gcd(e, f)
	e //= g
	f //= g
	c, d = e, f
print(c % 998244353, d % 998244353)
0