/ \ / 5 \ /-8 4\ /2 -3 6\ ---------
She could choose any of five valid sub-triangles (one of which is the entire original triangle):
/\
/ \ / \ / \ / \ /5 \
/ 5 \ / \5\ / 5 \ / 5/\ /----\
/-8 4\ /-8 \4\ /-8 4\ /-8/ 4\ /\-8 4/\
/2 -3 6\ / 2 -3\6\ /-------\ / 2/-3 6\ / 2\-3/6 \
--------- --------- -2 -3 6 --------- ----------
entire lower top lower upside
triangle left right down
The one that is lined below is the one with the highest average:
/ \ / 5/\ /-8/ 4\ / 2/-3 6\ ---------
The average of this sub-triangle is (4+6-3)/3, which is about
2.3333...; without the fraction, the answer is 2.
Help Bessie calculate the maximum amount of coins which she could receive.
* Line 1: Two space-separated integers: N and K
* Lines 2..N+1: Line i+1 will contain i space-separated integers:
* Line 1: The maximum number of coins that Bessie can receive (or, if negative, the best she can do for her loss).