| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 (추가 시간 없음) | 1024 MB (추가 메모리 없음) | 132 | 62 | 57 | 52.294% |
Two players A and B are playing a game called mukjjippa.
The game consists of several turns.
At the $i$-th turn (1ドル\le i\le n$):
Note that there is no attacker for the first turn.
If the game does not end until the beginning of the $(n+1)$-th turn, nobody is a winner.
The probability distribution of each choice is given. All choices are independent.
Find the probability that A wins.
The first line contains an integer $n$.
The $i$-th of the next $n$ lines contains three integers $r_i,ドル $s_i,ドル and $p_i$. This means that the probabilities that $X_i$ is $\mathrm R,ドル $\mathrm S,ドル and $\mathrm P$ are $\frac{r_i}{r_i+s_i+p_i},ドル $\frac{s_i}{r_i+s_i+p_i},ドル and $\frac{p_i}{r_i+s_i+p_i},ドル respectively.
The $i$-th of the next $n$ lines contains three integers $r_i',ドル $s_i',ドル and $p_i'$. This means that the probabilities that $Y_i$ is $\mathrm R,ドル $\mathrm S,ドル and $\mathrm P$ are $\frac{r_i'}{r_i'+s_i'+p_i'},ドル $\frac{s_i'}{r_i'+s_i'+p_i'},ドル and $\frac{p_i'}{r_i'+s_i'+p_i'},ドル respectively.
Let $\frac{x}{y}$ be the probability that A wins, where $x$ and $y$ are coprime integers, and $x\ge 0$ and $y>0$.
Print the integer $z$ such that $yz\equiv x\pmod{998,円 244,円 353}$ and 0ドル\le z<998,円 244,円 353$.
It can be proved that such an integer $z$ always exists and is uniquely determined, under the constraints of this problem.
2 1 0 0 0 1 0 0 1 0 0 1 0
1
2 1 1 1 1 1 1 1 1 1 1 1 1
443664157
University > KAIST > KAIST ICPC Mock Competition > 2024 KAIST 14th ICPC Mock Competition I번