1
0
Fork 0

Update number/mll.cc

This commit is contained in:
subcrip 2024-04-10 12:24:39 +08:00
parent 75293c3446
commit 58b2fc92fc
1 changed files with 1 additions and 9 deletions

View File

@ -6,6 +6,7 @@ template <ll mdl> struct MLL {
friend MLL operator*(const MLL& lhs, const MLL& rhs) { return mod(lhs.val * rhs.val, mdl); } friend MLL operator*(const MLL& lhs, const MLL& rhs) { return mod(lhs.val * rhs.val, mdl); }
friend MLL operator/(const MLL& lhs, const MLL& rhs) { return mod(lhs.val * mod(inverse(rhs.val, mdl), mdl), mdl); } friend MLL operator/(const MLL& lhs, const MLL& rhs) { return mod(lhs.val * mod(inverse(rhs.val, mdl), mdl), mdl); }
friend MLL operator%(const MLL& lhs, const MLL& rhs) { return mod(lhs.val - (lhs / rhs).val, mdl); } friend MLL operator%(const MLL& lhs, const MLL& rhs) { return mod(lhs.val - (lhs / rhs).val, mdl); }
friend MLL operator==(const MLL& lhs, const MLL& rhs) { return lhs.val == rhs.val; }
void operator+=(const MLL& rhs) { val = (*this + rhs).val; } void operator+=(const MLL& rhs) { val = (*this + rhs).val; }
void operator-=(const MLL& rhs) { val = (*this - rhs).val; } void operator-=(const MLL& rhs) { val = (*this - rhs).val; }
void operator*=(const MLL& rhs) { val = (*this * rhs).val; } void operator*=(const MLL& rhs) { val = (*this * rhs).val; }
@ -13,12 +14,3 @@ template <ll mdl> struct MLL {
void operator%=(const MLL& rhs) { val = (*this % rhs).val; } void operator%=(const MLL& rhs) { val = (*this % rhs).val; }
}; };
template <ll mdl>
ostream& operator<<(ostream& out, const MLL<mdl>& num) {
return out << num.val;
}
template <ll mdl>
istream& operator>>(istream& in, MLL<mdl>& num) {
return in >> num.val;
}