32 static int default_modulus;
38 static int print_mode;
73 Mod(
int _val,
int _mod){
86 Mod(
const Mod& other) : mod(other.mod), val(other.val) {}
101 if (mod == 0) {
return; }
166 if (default_modulus <= 0) {
169 return default_modulus;
179 return ((val == other.val) && (mod == other.mod));
183 return (*
this) ==
Mod(other, mod);
187 return !((*this) == other);
191 return (*
this) !=
Mod(other, mod);
195 if (mod < other.mod) {
return true; }
196 if (mod > other.mod) {
return false; }
197 if (val < other.val) {
return true; }
202 return (*
this) < other || (*this) == other;
206 return !((*this) <= other);
210 return !((*this) < other);
272 ostream&
operator<<(ostream& os,
const Mod& M);
Mod(int _val)
Kezdeti érték beállítása a default modulus mellett.
Mod multiply(const Mod &other) const
A szorzást megvalósító függvény.
static void set_default_modulus(int _def_mod)
Default modulus beállítása.
int get_mod() const
Modulus lekérdezése.
Mod operator*(int other) const
void set_val(int _val)
Maradékosztály beállítása.
Mod & operator-=(int other)
Mod()
Default konstruktor.
static void set_short_print_mode()
Kiírás módjának beállítása.
bool operator<=(const Mod &other) const
Mod & operator*=(int other)
static void set_normal_print_mode()
Kiírás módjának beállítása.
Mod operator-(int other) const
Mod & operator-=(const Mod &other)
bool operator==(int other) const
Mod inverse() const
Az inverzet számoló függvény.
Mod operator+(const Mod &other) const
void set_mod(int _mod)
Modulus beállítása.
bool operator>(const Mod &other) const
Mod(const Mod &other)
Másoló konstruktor.
int get_val() const
Maradékosztály reprezentánsa.
bool is_invalid() const
Invalid objektum lekérdezése.
bool operator!=(const Mod &other) const
Mod & operator+=(const Mod &other)
Mod(int _val, int _mod)
Kezdeti érték beállítása a default modulus mellett.
static int get_print_mode()
Kiírás módja.
Mod operator/(int other) const
bool operator<(const Mod &other) const
Mod operator/(const Mod &other) const
Mod operator*(const Mod &other) const
Mod pow(int k) const
Hatványozás.
static int get_default_modulus()
Default modulus lekérdezése.
Mod add(const Mod &other) const
Az összeadást megvalósító függvény.
Mod operator+(int other) const
bool operator!=(int other) const
Mod & operator/=(const Mod &other)
Mod operator-(const Mod &other) const
Mod & operator=(const Mod &other)
Mod & operator/=(int other)
Mod & operator+=(int other)
bool operator==(const Mod &other) const
Mod & operator*=(const Mod &other)
bool operator>=(const Mod &other) const
ostream & operator<<(ostream &os, const Mod &M)
Mod osztály kiírása a képernyőre.
const int NORMAL_PRINT_MODE
const int SHORT_PRINT_MODE
Mod operator/(int x, const Mod &M)
Mod operator*(int x, const Mod &M)
bool operator==(int x, const Mod &M)
Mod operator-(int x, const Mod &M)
const int INITIAL_DEFAULT_MODULUS
a default modulus kezdeti értéke
bool operator!=(int x, const Mod &M)
const int INITIAL_PRINT_MODE
a print mode kezdeti értéke
Mod operator+(int x, const Mod &M)