MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / Mod

Class Mod

code/mathematics/berlekamp_massey.test.cpp:4–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "../code/mathematics/mod_inv.cpp"
3
4struct Mod {
5 ll x;
6 Mod(ll _x = 0) {
7 x = (_x % 1000000007 + 1000000007) % 1000000007;
8 }
9 Mod operator +(const Mod &other) const {
10 return x + other.x;
11 }
12 Mod operator -(const Mod &other) const {
13 return x - other.x;
14 }
15 Mod operator -() const {
16 return -x;
17 }
18 Mod operator *(const Mod &other) const {
19 return x * other.x;
20 }
21 Mod operator /(const Mod &other) const {
22 return x * mod_inv(other.x, 1000000007);
23 }
24 bool operator ==(const Mod &other) const {
25 return x == other.x;
26 }
27};
28ostream& operator <<(ostream &outs, const Mod &x) {
29 return outs << x.x;
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected