This documentation is automatically generated by online-judge-tools/verification-helper
#include "src/modint/modint.hpp"
参考実装:AC Library (初期実装)
const ll mod = 998244353;
struct mm {
ll x;
mm(ll x_ = 0) : x(x_ % mod) {
if(x < 0) x += mod;
}
friend mm operator+(mm a, mm b) { return a.x + b.x; }
friend mm operator-(mm a, mm b) { return a.x - b.x; }
friend mm operator*(mm a, mm b) { return a.x * b.x; }
friend mm operator/(mm a, mm b) { return a * b.inv(); }
// 4 行コピペ Alt + Shift + クリックで複数カーソル
friend mm& operator+=(mm& a, mm b) { return a = a.x + b.x; }
friend mm& operator-=(mm& a, mm b) { return a = a.x - b.x; }
friend mm& operator*=(mm& a, mm b) { return a = a.x * b.x; }
friend mm& operator/=(mm& a, mm b) { return a = a * b.inv(); }
mm inv() const { return pow(mod - 2); }
mm pow(ll b) const {
mm a = *this, c = 1;
while(b) {
if(b & 1) c *= a;
a *= a;
b >>= 1;
}
return c;
}
};
#line 1 "src/modint/modint.hpp"
const ll mod = 998244353;
struct mm {
ll x;
mm(ll x_ = 0) : x(x_ % mod) {
if(x < 0) x += mod;
}
friend mm operator+(mm a, mm b) { return a.x + b.x; }
friend mm operator-(mm a, mm b) { return a.x - b.x; }
friend mm operator*(mm a, mm b) { return a.x * b.x; }
friend mm operator/(mm a, mm b) { return a * b.inv(); }
// 4 行コピペ Alt + Shift + クリックで複数カーソル
friend mm& operator+=(mm& a, mm b) { return a = a.x + b.x; }
friend mm& operator-=(mm& a, mm b) { return a = a.x - b.x; }
friend mm& operator*=(mm& a, mm b) { return a = a.x * b.x; }
friend mm& operator/=(mm& a, mm b) { return a = a * b.inv(); }
mm inv() const { return pow(mod - 2); }
mm pow(ll b) const {
mm a = *this, c = 1;
while(b) {
if(b & 1) c *= a;
a *= a;
b >>= 1;
}
return c;
}
};