Check if can cut horizontally at r1 , at least one apple in matrix ( r , c ) -> r1 , C - 1
if ( preSum [ r , c ] - preSum [ r1 , c ] > 0 ) dp [ k , r , c ] += dp [ k - 1 , r1 , c ] ; } for ( int c1 = c + 1 ; c1 < C ; c1 ++ ) {