結果
問題 |
No.1931 Fraction 2
|
ユーザー |
![]() |
提出日時 | 2022-05-06 21:51:40 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 338 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 272,612 KB |
最終ジャッジ日時 | 2024-07-06 17:17:28 |
合計ジャッジ時間 | 5,692 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 TLE * 1 -- * 24 |
ソースコード
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)