Function shakutori

Source
pub fn shakutori(
    n: usize,
    remove_left: impl FnMut(usize),
    can_append_right: impl Fn(usize, usize) -> bool,
    append_right: impl FnMut(usize),
    f: impl FnMut(usize, usize),
)
Expand description

尺取り法

  • remove_left - |l: usize| {尺取りの左端を縮めたときの操作}
  • can_append_right - |l: usize, r: usize| {l..r+1が条件を満たすかを判定}
  • append_right - |r: usize| {尺取りの右端を進めたときの操作}