Mary has given John two sticks of lengths
b respectively, where
b are positive integers.
John is very curious.
He would like to know how many triangles with integer perimeter can be formed, by having one additional side.
Please help him find it out.
(This is my first time composing this kind of stupid stories in coding problems, so forgive me if it is too stupid.)
- Given two integers
b, find the number of triangles with integer perimeter that can be formed, by having one additional side.
- Congruent triangles are congruent.
- Flat triangles are flat out uncounted.
- Zero-sided triangles are counted zero times.
This is code-golf. Shortest solution in bytes wins.
a b output 1 2 1 3 3 5 9 7 13