1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#[cfg(not(feature = "atcoder"))]
mod dynamic;
#[cfg(not(feature = "atcoder"))]
pub use dynamic::Digit as DynamicDigit;

mod r#static;
pub use r#static::Digit as StaticDigit;

pub(crate) fn into(mut n: u64, d: u32) -> Vec<u32> {
    let mut res = Vec::new();

    while n > 0 {
        let rem = n % d as u64;
        res.push(rem as u32);
        n -= rem;
        n /= d as u64;
    }

    res.reverse();
    res
}