結果

問題 No.1931 Fraction 2
ユーザー chocoruskchocorusk
提出日時 2022-05-06 21:51:40
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 338 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 98,188 KB
最終ジャッジ日時 2023-09-20 22:31:06
合計ジャッジ時間 7,293 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,700 KB
testcase_01 AC 97 ms
71,484 KB
testcase_02 AC 96 ms
71,828 KB
testcase_03 AC 107 ms
72,296 KB
testcase_04 AC 112 ms
76,328 KB
testcase_05 AC 107 ms
72,412 KB
testcase_06 AC 115 ms
76,528 KB
testcase_07 AC 109 ms
72,304 KB
testcase_08 AC 104 ms
72,120 KB
testcase_09 AC 111 ms
72,256 KB
testcase_10 AC 97 ms
71,548 KB
testcase_11 AC 108 ms
72,432 KB
testcase_12 AC 103 ms
72,428 KB
testcase_13 AC 970 ms
98,188 KB
testcase_14 TLE -
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 #

from collections import deque
import math
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
    a[i], b[i]=map(int, input().split())
deq=deque(zip(a, b))
while len(deq)>1:
    p=deq.popleft()
    q=deq.popleft()
    deq.append((p[0]*q[1]+p[1]*q[0], p[1]*q[1]))
p=deq[0]
g=math.gcd(p[0],p[1])
MOD=998244353
print(p[0]//g%MOD, p[1]//g%MOD)
0