結果

問題 No.1931 Fraction 2
ユーザー ytqm3ytqm3
提出日時 2022-04-27 23:25:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 266 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 84,652 KB
最終ジャッジ日時 2023-09-20 22:29:58
合計ジャッジ時間 7,053 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,296 KB
testcase_01 AC 77 ms
71,488 KB
testcase_02 AC 74 ms
71,172 KB
testcase_03 AC 169 ms
71,700 KB
testcase_04 AC 208 ms
75,464 KB
testcase_05 AC 153 ms
71,520 KB
testcase_06 AC 238 ms
76,092 KB
testcase_07 AC 149 ms
71,444 KB
testcase_08 AC 91 ms
71,624 KB
testcase_09 AC 166 ms
71,708 KB
testcase_10 AC 77 ms
71,404 KB
testcase_11 AC 156 ms
71,716 KB
testcase_12 AC 86 ms
71,508 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

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