Skip to content

Commit a3bc39a

Browse files
authored
Update Readme.md
1 parent 6006676 commit a3bc39a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Template/Inverse_Element/Readme.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
CF中经常会要求这样输出结果:```Let this probability be represented as an irreducible fraction x/y. You have to print x⋅y^−1 mod 998244353, where y^−1 is the inverse element of y modulo 998244353 (such integer that y⋅y−1 has remainder 1 modulo 998244353).```
1+
CF中经常会要求这样输出结果:
2+
```
3+
Let this probability be represented as an irreducible fraction x/y. You have to print x⋅y^−1 mod 998244353, where y^−1 is the inverse element of y modulo 998244353 (such integer that y⋅y−1 has remainder 1 modulo 998244353).
4+
```
25

36
这里的inverse element并不是指的倒数,而是逆元。y的逆元写作y^-1,
47

@@ -28,8 +31,9 @@ a^-1 ≡ a ^ (M-2) (mod M)
2831
```cpp
2932
const ll N = 1e6+7, M = 998244353;
3033
ll inv[N];
31-
for(inv[1]=1,i=2;i<N;++i)
32-
inv[i]=(M - M/i) * inv[M % i] % M
34+
int i;
35+
for(inv[1]=1, i=2; i<N; ++i)
36+
inv[i] = (M - M/i) * inv[M % i] % M
3337
```
3438

3539
#### 逆元的一些性质

0 commit comments

Comments
 (0)