pub struct DynamicModInt<I> { /* private fields */ }Expand description
Represents $\mathbb{Z}/m\mathbb{Z}$ where $m$ is a dynamic value.
Corresponds to atcoder::dynamic_modint in the original ACL.
§Example
use ac_library::ModInt as Mint;
use proconio::{input, source::once::OnceSource};
input! {
from OnceSource::from("3 3 7\n"),
a: u32,
b: u32,
m: u32,
}
Mint::set_modulus(m);
let a = Mint::new(a);
let b = Mint::new(b);
println!("{}", a * b); // `2`Implementations§
Source§impl<I: Id> DynamicModInt<I>
impl<I: Id> DynamicModInt<I>
Sourcepub fn modulus() -> u32
pub fn modulus() -> u32
Returns the modulus.
Corresponds to atcoder::dynamic_modint::mod in the original ACL.
§Example
use ac_library::ModInt as Mint;
assert_eq!(998_244_353, Mint::modulus()); // default modulusSourcepub fn set_modulus(modulus: u32)
pub fn set_modulus(modulus: u32)
Sourcepub fn new<T: RemEuclidU32>(val: T) -> Self
pub fn new<T: RemEuclidU32>(val: T) -> Self
Creates a new DynamicModInt.
Takes any primitive integer.
Corresponds to the constructor of atcoder::dynamic_modint in the original ACL.
Sourcepub fn raw(val: u32) -> Self
pub fn raw(val: u32) -> Self
Constructs a DynamicModInt from a val < Self::modulus() without checking it.
Corresponds to atcoder::dynamic_modint::raw in the original ACL.
§Constraints
valis 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<I: Id> Add<&DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Add<&DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
+ operator.Source§fn add(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn add(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
+ operation. Read moreSource§impl<I: Id> Add<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> Add<&DynamicModInt<I>> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
+ operator.Source§fn add(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn add(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
+ operation. Read moreSource§impl<I: Id> Add<DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Add<DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
+ operator.Source§fn add(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn add(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
+ operation. Read moreSource§impl<I: Id, T: RemEuclidU32> Add<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> Add<T> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
+ operator.Source§fn add(self, rhs: T) -> DynamicModInt<I>
fn add(self, rhs: T) -> DynamicModInt<I>
Performs the
+ operation. Read moreSource§impl<I: Id> Add for DynamicModInt<I>
impl<I: Id> Add for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
+ operator.Source§fn add(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn add(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
+ operation. Read moreSource§impl<I: Id> AddAssign<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> AddAssign<&DynamicModInt<I>> for DynamicModInt<I>
Source§fn add_assign(&mut self, rhs: &DynamicModInt<I>)
fn add_assign(&mut self, rhs: &DynamicModInt<I>)
Performs the
+= operation. Read moreSource§impl<I: Id, T: RemEuclidU32> AddAssign<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> AddAssign<T> for DynamicModInt<I>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl<I: Id> AddAssign for DynamicModInt<I>
impl<I: Id> AddAssign for DynamicModInt<I>
Source§fn add_assign(&mut self, rhs: DynamicModInt<I>)
fn add_assign(&mut self, rhs: DynamicModInt<I>)
Performs the
+= operation. Read moreSource§impl<I: Clone> Clone for DynamicModInt<I>
impl<I: Clone> Clone for DynamicModInt<I>
Source§fn clone(&self) -> DynamicModInt<I>
fn clone(&self) -> DynamicModInt<I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<I: Id> Debug for DynamicModInt<I>
impl<I: Id> Debug for DynamicModInt<I>
Source§impl<I: Id> Default for DynamicModInt<I>
impl<I: Id> Default for DynamicModInt<I>
Source§impl<I: Id> Display for DynamicModInt<I>
impl<I: Id> Display for DynamicModInt<I>
Source§impl<I: Id> Div<&DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Div<&DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
/ operator.Source§fn div(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn div(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
/ operation. Read moreSource§impl<I: Id> Div<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> Div<&DynamicModInt<I>> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
/ operator.Source§fn div(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn div(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
/ operation. Read moreSource§impl<I: Id> Div<DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Div<DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
/ operator.Source§fn div(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn div(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
/ operation. Read moreSource§impl<I: Id, T: RemEuclidU32> Div<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> Div<T> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
/ operator.Source§fn div(self, rhs: T) -> DynamicModInt<I>
fn div(self, rhs: T) -> DynamicModInt<I>
Performs the
/ operation. Read moreSource§impl<I: Id> Div for DynamicModInt<I>
impl<I: Id> Div for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
/ operator.Source§fn div(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn div(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
/ operation. Read moreSource§impl<I: Id> DivAssign<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> DivAssign<&DynamicModInt<I>> for DynamicModInt<I>
Source§fn div_assign(&mut self, rhs: &DynamicModInt<I>)
fn div_assign(&mut self, rhs: &DynamicModInt<I>)
Performs the
/= operation. Read moreSource§impl<I: Id, T: RemEuclidU32> DivAssign<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> DivAssign<T> for DynamicModInt<I>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreSource§impl<I: Id> DivAssign for DynamicModInt<I>
impl<I: Id> DivAssign for DynamicModInt<I>
Source§fn div_assign(&mut self, rhs: DynamicModInt<I>)
fn div_assign(&mut self, rhs: DynamicModInt<I>)
Performs the
/= operation. Read moreSource§impl<I: Id, V: RemEuclidU32> From<V> for DynamicModInt<I>
impl<I: Id, V: RemEuclidU32> From<V> for DynamicModInt<I>
Source§impl<I: Id> FromStr for DynamicModInt<I>
impl<I: Id> FromStr for DynamicModInt<I>
Source§impl<I: Id> Hash for DynamicModInt<I>
impl<I: Id> Hash for DynamicModInt<I>
Source§impl<I: Id> ModIntBase for DynamicModInt<I>
These methods are implemented for the struct.
You don’t need to use ModIntBase to call methods of DynamicModInt.
impl<I: Id> ModIntBase for DynamicModInt<I>
These methods are implemented for the struct.
You don’t need to use ModIntBase to call methods of DynamicModInt.
Source§impl<I: Id> Mul<&DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Mul<&DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn mul(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
* operation. Read moreSource§impl<I: Id> Mul<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> Mul<&DynamicModInt<I>> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn mul(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
* operation. Read moreSource§impl<I: Id> Mul<DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Mul<DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn mul(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
* operation. Read moreSource§impl<I: Id, T: RemEuclidU32> Mul<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> Mul<T> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: T) -> DynamicModInt<I>
fn mul(self, rhs: T) -> DynamicModInt<I>
Performs the
* operation. Read moreSource§impl<I: Id> Mul for DynamicModInt<I>
impl<I: Id> Mul for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
* operator.Source§fn mul(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn mul(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
* operation. Read moreSource§impl<I: Id> MulAssign<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> MulAssign<&DynamicModInt<I>> for DynamicModInt<I>
Source§fn mul_assign(&mut self, rhs: &DynamicModInt<I>)
fn mul_assign(&mut self, rhs: &DynamicModInt<I>)
Performs the
*= operation. Read moreSource§impl<I: Id, T: RemEuclidU32> MulAssign<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> MulAssign<T> for DynamicModInt<I>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moreSource§impl<I: Id> MulAssign for DynamicModInt<I>
impl<I: Id> MulAssign for DynamicModInt<I>
Source§fn mul_assign(&mut self, rhs: DynamicModInt<I>)
fn mul_assign(&mut self, rhs: DynamicModInt<I>)
Performs the
*= operation. Read moreSource§impl<I: Id> Neg for &DynamicModInt<I>
impl<I: Id> Neg for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn neg(self) -> DynamicModInt<I>
fn neg(self) -> DynamicModInt<I>
Performs the unary
- operation. Read moreSource§impl<I: Id> Neg for DynamicModInt<I>
impl<I: Id> Neg for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn neg(self) -> DynamicModInt<I>
fn neg(self) -> DynamicModInt<I>
Performs the unary
- operation. Read moreSource§impl<I: PartialEq> PartialEq for DynamicModInt<I>
impl<I: PartialEq> PartialEq for DynamicModInt<I>
Source§impl<'a, I: Id> Product<&'a DynamicModInt<I>> for DynamicModInt<I>
impl<'a, I: Id> Product<&'a DynamicModInt<I>> for DynamicModInt<I>
Source§impl<I: Id> Product for DynamicModInt<I>
impl<I: Id> Product for DynamicModInt<I>
Source§impl<I: Id> Sub<&DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Sub<&DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn sub(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn sub(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
- operation. Read moreSource§impl<I: Id> Sub<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> Sub<&DynamicModInt<I>> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn sub(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
fn sub(self, rhs: &DynamicModInt<I>) -> DynamicModInt<I>
Performs the
- operation. Read moreSource§impl<I: Id> Sub<DynamicModInt<I>> for &DynamicModInt<I>
impl<I: Id> Sub<DynamicModInt<I>> for &DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn sub(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn sub(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
- operation. Read moreSource§impl<I: Id, T: RemEuclidU32> Sub<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> Sub<T> for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn sub(self, rhs: T) -> DynamicModInt<I>
fn sub(self, rhs: T) -> DynamicModInt<I>
Performs the
- operation. Read moreSource§impl<I: Id> Sub for DynamicModInt<I>
impl<I: Id> Sub for DynamicModInt<I>
Source§type Output = DynamicModInt<I>
type Output = DynamicModInt<I>
The resulting type after applying the
- operator.Source§fn sub(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
fn sub(self, rhs: DynamicModInt<I>) -> DynamicModInt<I>
Performs the
- operation. Read moreSource§impl<I: Id> SubAssign<&DynamicModInt<I>> for DynamicModInt<I>
impl<I: Id> SubAssign<&DynamicModInt<I>> for DynamicModInt<I>
Source§fn sub_assign(&mut self, rhs: &DynamicModInt<I>)
fn sub_assign(&mut self, rhs: &DynamicModInt<I>)
Performs the
-= operation. Read moreSource§impl<I: Id, T: RemEuclidU32> SubAssign<T> for DynamicModInt<I>
impl<I: Id, T: RemEuclidU32> SubAssign<T> for DynamicModInt<I>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moreSource§impl<I: Id> SubAssign for DynamicModInt<I>
impl<I: Id> SubAssign for DynamicModInt<I>
Source§fn sub_assign(&mut self, rhs: DynamicModInt<I>)
fn sub_assign(&mut self, rhs: DynamicModInt<I>)
Performs the
-= operation. Read moreSource§impl<'a, I: Id> Sum<&'a DynamicModInt<I>> for DynamicModInt<I>
impl<'a, I: Id> Sum<&'a DynamicModInt<I>> for DynamicModInt<I>
Source§impl<I: Id> Sum for DynamicModInt<I>
impl<I: Id> Sum for DynamicModInt<I>
impl<I: Copy> Copy for DynamicModInt<I>
impl<I: Eq> Eq for DynamicModInt<I>
impl<I> StructuralPartialEq for DynamicModInt<I>
Auto Trait Implementations§
impl<I> Freeze for DynamicModInt<I>
impl<I> RefUnwindSafe for DynamicModInt<I>
impl<I> Send for DynamicModInt<I>
impl<I> Sync for DynamicModInt<I>
impl<I> Unpin for DynamicModInt<I>
impl<I> UnwindSafe for DynamicModInt<I>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more