KDCT01 - Editorial

PROBLEM LINKS

Contest


DIFFICULTY

Cakewalk

Explaination:


Fact:- If two sides of the triangle are given, in order to maximise the area, we have to choose the third side in such a way that the triangle becomes right angled.

Now, consider a right angled triangle ABC.

If the given 2 sides form the non hypotenuse sides of ABC, then obviously we can achieve the maximum perimeter (since the hypotenuse will be bigger than either of the given sides).

Now, if the greater of the given 2 sides form the hypotenuse of the triangle, minimum perimeter is achieved.

Calculate the perimeters accordingly, and get the difference. Compare the difference with the input difference, and get the count of the required cases.