fn compute_fuel(pos: usize, crabs: &[usize]) -> (usize, usize) {
    crabs.iter().fold((0, 0), |x, c| {
        (
            x.0 + (c.abs_diff(pos) * (c.abs_diff(pos) + 1) / 2),
            x.1 + (c.abs_diff(pos + 1) * (c.abs_diff(pos + 1) + 1) / 2),
        )
    })
}
/// Computes fuel consumption for pos and pos+1
Computes fuel consumption for pos and pos+1
Computes fuel consumption for pos and pos + 1
fn compute_fuel(pos: usize, crabs: &[usize]) -> (usize, usize) {
    crabs.iter().fold((0, 0), |x, c| {
        (
            x.0 + (c.abs_diff(pos) * (c.abs_diff(pos) + 1) / 2),
            x.1 + (c.abs_diff(pos + 1) * (c.abs_diff(pos + 1) + 1) / 2),
        )
    })
}
fn compute_fuel ( pos : usize , crabs : & [ usize ] ) -> ( usize , usize ) { crabs . iter ( ) . fold ( ( 0 , 0 ) , | x , c | { ( x . 0 + ( c . abs_diff ( pos ) * ( c . abs_diff ( pos ) + 1 ) / 2 ) , x . 1 + ( c . abs_diff ( pos + 1 ) * ( c . abs_diff ( pos + 1 ) + 1 ) / 2 ) , ) } ) }
Computes fuel consumption for pos and pos+1
Computes fuel consumption for pos and pos + 1
pos
usize
crabs
&[usize]