Skip to main content

DynMIntU32

Type Alias DynMIntU32 

Source
pub type DynMIntU32 = MInt<DynModuloU32>;

Aliased Type§

#[repr(transparent)]
pub struct DynMIntU32 { x: u32, _marker: PhantomData<fn() -> DynModuloU32>, }

Fields§

§x: u32§_marker: PhantomData<fn() -> DynModuloU32>

Implementations§

Source§

impl DynMIntU32

Source

pub fn set_mod(m: u32)

Examples found in repository?
crates/library_checker/src/number_theory/sqrt_mod.rs (line 11)
6pub fn sqrt_mod(reader: impl Read, mut writer: impl Write) {
7    let s = read_all_unchecked(reader);
8    let mut scanner = Scanner::new(&s);
9    scan!(scanner, q, yp: [(u32, u32)]);
10    for (y, p) in yp.take(q) {
11        DynMIntU32::set_mod(p);
12        if let Some(x) = DynMIntU32::from(y).sqrt() {
13            writeln!(writer, "{}", x).ok();
14        } else {
15            writeln!(writer, "-1").ok();
16        }
17    }
18}
More examples
Hide additional examples
crates/library_checker/src/enumerative_combinatorics/binomial_coefficient_prime_mod.rs (line 10)
6pub fn binomial_coefficient_prime_mod(reader: impl Read, mut writer: impl Write) {
7    let s = read_all_unchecked(reader);
8    let mut scanner = Scanner::new(&s);
9    scan!(scanner, t, m: u32, nk: [(usize, usize); t]);
10    DynMIntU32::set_mod(m);
11    let max_n = nk.iter().map(|(n, _)| n).max().cloned().unwrap_or_default();
12    let f = MemorizedFactorial::new(max_n);
13    for (n, k) in nk {
14        let ans: DynMIntU32 = f.combination(n, k);
15        iter_print!(writer, ans);
16    }
17}