pub struct StaticModInt<M> { /* private fields */ }
Expand description
Represents $\mathbb{Z}/m\mathbb{Z}$ where $m$ is a constant value.
Corresponds to atcoder::static_modint
in the original ACL.
§Example
use ac_library::ModInt1000000007 as Mint;
use proconio::{input, source::once::OnceSource};
input! {
from OnceSource::from("1000000006 2\n"),
a: Mint,
b: Mint,
}
println!("{}", a + b); // `1`
Implementations§
Source§impl<M: Modulus> StaticModInt<M>
impl<M: Modulus> StaticModInt<M>
Sourcepub fn modulus() -> u32
pub fn modulus() -> u32
Returns the modulus, which is <M as Modulus>::VALUE
.
Corresponds to atcoder::static_modint::mod
in the original ACL.
§Example
use ac_library::ModInt1000000007 as Mint;
assert_eq!(1_000_000_007, Mint::modulus());
Sourcepub fn new<T: RemEuclidU32>(val: T) -> Self
pub fn new<T: RemEuclidU32>(val: T) -> Self
Creates a new StaticModInt
.
Takes any primitive integer.
Corresponds to the constructor of atcoder::static_modint
in the original ACL.
Sourcepub fn raw(val: u32) -> Self
pub fn raw(val: u32) -> Self
Constructs a StaticModInt
from a val < Self::modulus()
without checking it.
Corresponds to atcoder::static_modint::raw
in the original ACL.
§Constraints
val
is less thanSelf::modulus()
See ModIntBase::raw
for more more details.
Sourcepub fn val(self) -> u32
pub fn val(self) -> u32
Retruns the representative.
Corresponds to atcoder::static_modint::val
in the original ACL.
Trait Implementations§
Source§impl<M: Modulus> Add<&StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Add<&StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
+
operator.Source§fn add(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn add(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
+
operation. Read moreSource§impl<M: Modulus> Add<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> Add<&StaticModInt<M>> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
+
operator.Source§fn add(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn add(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
+
operation. Read moreSource§impl<M: Modulus> Add<StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Add<StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
+
operator.Source§fn add(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn add(self, rhs: StaticModInt<M>) -> StaticModInt<M>
+
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> Add<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> Add<T> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
+
operator.Source§fn add(self, rhs: T) -> StaticModInt<M>
fn add(self, rhs: T) -> StaticModInt<M>
+
operation. Read moreSource§impl<M: Modulus> Add for StaticModInt<M>
impl<M: Modulus> Add for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
+
operator.Source§fn add(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn add(self, rhs: StaticModInt<M>) -> StaticModInt<M>
+
operation. Read moreSource§impl<M: Modulus> AddAssign<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> AddAssign<&StaticModInt<M>> for StaticModInt<M>
Source§fn add_assign(&mut self, rhs: &StaticModInt<M>)
fn add_assign(&mut self, rhs: &StaticModInt<M>)
+=
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> AddAssign<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> AddAssign<T> for StaticModInt<M>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+=
operation. Read moreSource§impl<M: Modulus> AddAssign for StaticModInt<M>
impl<M: Modulus> AddAssign for StaticModInt<M>
Source§fn add_assign(&mut self, rhs: StaticModInt<M>)
fn add_assign(&mut self, rhs: StaticModInt<M>)
+=
operation. Read moreSource§impl<M: Clone> Clone for StaticModInt<M>
impl<M: Clone> Clone for StaticModInt<M>
Source§fn clone(&self) -> StaticModInt<M>
fn clone(&self) -> StaticModInt<M>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<M: Modulus> Debug for StaticModInt<M>
impl<M: Modulus> Debug for StaticModInt<M>
Source§impl<M: Modulus> Default for StaticModInt<M>
impl<M: Modulus> Default for StaticModInt<M>
Source§impl<M: Modulus> Display for StaticModInt<M>
impl<M: Modulus> Display for StaticModInt<M>
Source§impl<M: Modulus> Div<&StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Div<&StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
/
operator.Source§fn div(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn div(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
/
operation. Read moreSource§impl<M: Modulus> Div<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> Div<&StaticModInt<M>> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
/
operator.Source§fn div(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn div(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
/
operation. Read moreSource§impl<M: Modulus> Div<StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Div<StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
/
operator.Source§fn div(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn div(self, rhs: StaticModInt<M>) -> StaticModInt<M>
/
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> Div<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> Div<T> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
/
operator.Source§fn div(self, rhs: T) -> StaticModInt<M>
fn div(self, rhs: T) -> StaticModInt<M>
/
operation. Read moreSource§impl<M: Modulus> Div for StaticModInt<M>
impl<M: Modulus> Div for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
/
operator.Source§fn div(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn div(self, rhs: StaticModInt<M>) -> StaticModInt<M>
/
operation. Read moreSource§impl<M: Modulus> DivAssign<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> DivAssign<&StaticModInt<M>> for StaticModInt<M>
Source§fn div_assign(&mut self, rhs: &StaticModInt<M>)
fn div_assign(&mut self, rhs: &StaticModInt<M>)
/=
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> DivAssign<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> DivAssign<T> for StaticModInt<M>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/=
operation. Read moreSource§impl<M: Modulus> DivAssign for StaticModInt<M>
impl<M: Modulus> DivAssign for StaticModInt<M>
Source§fn div_assign(&mut self, rhs: StaticModInt<M>)
fn div_assign(&mut self, rhs: StaticModInt<M>)
/=
operation. Read moreSource§impl<M: Modulus, V: RemEuclidU32> From<V> for StaticModInt<M>
impl<M: Modulus, V: RemEuclidU32> From<V> for StaticModInt<M>
Source§impl<M: Modulus> FromStr for StaticModInt<M>
impl<M: Modulus> FromStr for StaticModInt<M>
Source§impl<M: Modulus> Hash for StaticModInt<M>
impl<M: Modulus> Hash for StaticModInt<M>
Source§impl<M: Modulus> ModIntBase for StaticModInt<M>
These methods are implemented for the struct.
You don’t need to use
ModIntBase
to call methods of StaticModInt
.
impl<M: Modulus> ModIntBase for StaticModInt<M>
These methods are implemented for the struct.
You don’t need to use
ModIntBase
to call methods of StaticModInt
.
Source§impl<M: Modulus> Mul<&StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Mul<&StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
*
operator.Source§fn mul(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn mul(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
*
operation. Read moreSource§impl<M: Modulus> Mul<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> Mul<&StaticModInt<M>> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
*
operator.Source§fn mul(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn mul(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
*
operation. Read moreSource§impl<M: Modulus> Mul<StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Mul<StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
*
operator.Source§fn mul(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn mul(self, rhs: StaticModInt<M>) -> StaticModInt<M>
*
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> Mul<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> Mul<T> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
*
operator.Source§fn mul(self, rhs: T) -> StaticModInt<M>
fn mul(self, rhs: T) -> StaticModInt<M>
*
operation. Read moreSource§impl<M: Modulus> Mul for StaticModInt<M>
impl<M: Modulus> Mul for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
*
operator.Source§fn mul(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn mul(self, rhs: StaticModInt<M>) -> StaticModInt<M>
*
operation. Read moreSource§impl<M: Modulus> MulAssign<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> MulAssign<&StaticModInt<M>> for StaticModInt<M>
Source§fn mul_assign(&mut self, rhs: &StaticModInt<M>)
fn mul_assign(&mut self, rhs: &StaticModInt<M>)
*=
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> MulAssign<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> MulAssign<T> for StaticModInt<M>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*=
operation. Read moreSource§impl<M: Modulus> MulAssign for StaticModInt<M>
impl<M: Modulus> MulAssign for StaticModInt<M>
Source§fn mul_assign(&mut self, rhs: StaticModInt<M>)
fn mul_assign(&mut self, rhs: StaticModInt<M>)
*=
operation. Read moreSource§impl<M: Modulus> Neg for &StaticModInt<M>
impl<M: Modulus> Neg for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn neg(self) -> StaticModInt<M>
fn neg(self) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: Modulus> Neg for StaticModInt<M>
impl<M: Modulus> Neg for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn neg(self) -> StaticModInt<M>
fn neg(self) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: PartialEq> PartialEq for StaticModInt<M>
impl<M: PartialEq> PartialEq for StaticModInt<M>
Source§impl<'a, M: Modulus> Product<&'a StaticModInt<M>> for StaticModInt<M>
impl<'a, M: Modulus> Product<&'a StaticModInt<M>> for StaticModInt<M>
Source§impl<M: Modulus> Product for StaticModInt<M>
impl<M: Modulus> Product for StaticModInt<M>
Source§impl<M: Modulus> Sub<&StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Sub<&StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn sub(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn sub(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: Modulus> Sub<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> Sub<&StaticModInt<M>> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn sub(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
fn sub(self, rhs: &StaticModInt<M>) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: Modulus> Sub<StaticModInt<M>> for &StaticModInt<M>
impl<M: Modulus> Sub<StaticModInt<M>> for &StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn sub(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn sub(self, rhs: StaticModInt<M>) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> Sub<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> Sub<T> for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn sub(self, rhs: T) -> StaticModInt<M>
fn sub(self, rhs: T) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: Modulus> Sub for StaticModInt<M>
impl<M: Modulus> Sub for StaticModInt<M>
Source§type Output = StaticModInt<M>
type Output = StaticModInt<M>
-
operator.Source§fn sub(self, rhs: StaticModInt<M>) -> StaticModInt<M>
fn sub(self, rhs: StaticModInt<M>) -> StaticModInt<M>
-
operation. Read moreSource§impl<M: Modulus> SubAssign<&StaticModInt<M>> for StaticModInt<M>
impl<M: Modulus> SubAssign<&StaticModInt<M>> for StaticModInt<M>
Source§fn sub_assign(&mut self, rhs: &StaticModInt<M>)
fn sub_assign(&mut self, rhs: &StaticModInt<M>)
-=
operation. Read moreSource§impl<M: Modulus, T: RemEuclidU32> SubAssign<T> for StaticModInt<M>
impl<M: Modulus, T: RemEuclidU32> SubAssign<T> for StaticModInt<M>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-=
operation. Read moreSource§impl<M: Modulus> SubAssign for StaticModInt<M>
impl<M: Modulus> SubAssign for StaticModInt<M>
Source§fn sub_assign(&mut self, rhs: StaticModInt<M>)
fn sub_assign(&mut self, rhs: StaticModInt<M>)
-=
operation. Read more