Advertisement
konchin_shih

Untitled

Oct 24th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. constexpr int mod = 998244353;
  2. struct modint {
  3.     int data; modint(int x = 0): data(x) {pull();}
  4.     modint& pull() {if (data < 0) data = (data + mod) % mod; return *this;}
  5. };
  6. modint operator+(modint a, modint b) {return modint((a.data + b.data) % mod) .pull();}
  7. modint operator-(modint a, modint b) {return modint((a.data - b.data) % mod) .pull();}
  8. modint operator*(modint a, modint b) {return modint(int(1LL * a.data * b.data % mod)) .pull();}
  9. istream& operator>>(istream& is, modint& x) {return is >> x.data;}
  10. ostream& operator<<(ostream& os, const modint& x) {return os << x.data;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement