diff --git a/content/number-theory/ModularArithmetic.h b/content/number-theory/ModularArithmetic.h index 4a62aae5f..25da57447 100644 --- a/content/number-theory/ModularArithmetic.h +++ b/content/number-theory/ModularArithmetic.h @@ -1,5 +1,5 @@ /** - * Author: Lukas Polacek + * Author: Lukas Polacek, Joshua Andersson * Date: 2009-09-28 * License: CC0 * Source: folklore @@ -13,17 +13,18 @@ const ll mod = 17; // change to something else struct Mod { ll x; - Mod(ll xx) : x(xx) {} - Mod operator+(Mod b) { return Mod((x + b.x) % mod); } - Mod operator-(Mod b) { return Mod((x - b.x + mod) % mod); } - Mod operator*(Mod b) { return Mod((x * b.x) % mod); } + Mod(ll y) : Mod(y%mod+mod,0){} + Mod(ll y,int) : x(y